:root {
    --gradient-start: #6A11CB;
    --gradient-end: #2575FC;
    --surface-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #475569;
    --text-eyebrow: #64748b;
    --border-color: #e2e8f0;
    --chip-bg: #eef2ff;
    --chip-border: #dbeafe;
    --soft-surface: #f2f4f7;
    --button-light-bg: #ffffff;
    --button-light-border: #e2e8f0;
    --button-light-text: #4A288C;
}
body.dark-mode {
    --gradient-start: #080d1a;
    --gradient-end: #0c1424;
    --surface-bg: #0f1624;
    --card-bg: #111b2f;
    --text-primary: #e8edf5;
    --text-secondary: #cbd7eb;
    --text-muted: #9ba9c4;
    --text-eyebrow: #7f8bad;
    --border-color: #1f2b3d;
    --chip-bg: #161f33;
    --chip-border: #22304a;
    --soft-surface: #10192b;
    --button-light-bg: #141d31;
    --button-light-border: #22304a;
    --button-light-text: #e8edf5;
    --elevated-1: #111b2f;
    --elevated-2: #0f1728;
    --stroke-strong: #1f2b3d;
    --shadow-strong: rgba(0, 0, 0, 0.55);
    color: var(--text-primary);
    background-color: #080d1a;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    height: 100vh;
}
html.ui-lang-preload body { visibility: hidden; }

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    z-index: -1;
}

.main-container {
    height: 100vh;
    overflow-y: auto;
    padding: clamp(1.5rem, 3vw, 3rem);
    max-width: 1320px;
    margin: 0 auto;
}

.surface-panel {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: var(--surface-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: clamp(1.5rem, 2.5vw, 2.6rem);
    box-shadow: 0 28px 60px rgba(15,23,42,0.14);
}
.surface-panel h1,
.surface-panel h2,
.surface-panel h3,
.surface-panel h4,
.surface-panel h5,
.surface-panel h6 {
    color: var(--text-primary);
}
.surface-panel p {
    color: var(--text-secondary);
}
.surface-panel .surface-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--text-eyebrow);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}
.surface-panel .surface-title {
    font-weight: 800;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}
.surface-panel .surface-subtitle {
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.surface-panel--form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}
.surface-panel--form .surface-subtitle {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.logo {
    width: 140px;
    height: 140px;
    margin-bottom: 1.5rem;
}
.logo-button {
    position: relative;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
}
.logo-button:focus-visible { outline: 3px solid rgba(255,255,255,0.7); border-radius: 50%; }
.hero-owl-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.2rem 0.4rem;
    border-radius: 18px;
}
.hero-owl-wrapper .logo {
    transition: transform 0.2s ease, filter 0.2s ease;
    filter: drop-shadow(0 12px 28px rgba(0,0,0,0.25));
}
.hero-owl-wrapper:hover .logo,
.hero-owl-wrapper:focus-within .logo {
    transform: translateY(-4px) scale(1.03);
    filter: drop-shadow(0 18px 36px rgba(0,0,0,0.3));
}
.owl-speech-bubble {
    position: absolute;
    top: -50px;
    right: -6px;
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.55rem 0.9rem;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 18px 40px rgba(0,0,0,0.22);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transform-origin: top right;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.owl-speech-bubble::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 18px;
    width: 18px;
    height: 18px;
    background: var(--card-bg);
    transform: rotate(45deg);
    box-shadow: 0 10px 22px rgba(0,0,0,0.15);
}
.hero-owl-wrapper:hover .owl-speech-bubble,
.hero-owl-wrapper:focus-within .owl-speech-bubble {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 24px 48px rgba(0,0,0,0.26);
}
@media (max-width: 576px) {
    .hero-owl-wrapper {
        flex-direction: column;
        gap: 0.5rem;
    }
    .owl-speech-bubble {
        position: static;
        transform: none;
        box-shadow: 0 14px 32px rgba(0,0,0,0.22);
    }
    .owl-speech-bubble::after { display: none; }
}
.logo-chat-badge {
    display: none;
}

/* --- CTA Hibou tuteur --- */
.owl-cta-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    padding: 1.1rem 1.4rem;
    margin: 1rem auto 1.5rem;
    background: linear-gradient(120deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 20px;
    box-shadow: 0 20px 48px rgba(0,0,0,0.24);
    flex-wrap: wrap;
}
.owl-cta-text h3 { font-weight: 800; margin: 0; }
.owl-cta-text p { margin-bottom: 0.35rem; color: rgba(255,255,255,0.92); }
.owl-cta-eyebrow { letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: rgba(255,255,255,0.8); font-size: 0.85rem; }
.owl-cta-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.owl-cta-hint { font-size: 0.95rem; color: rgba(255,255,255,0.8); }
.owl-cta-visual { position: relative; display: flex; align-items: center; justify-content: center; min-width: 140px; }
.owl-cta-bubble { position: absolute; right: -10px; top: -10px; background: #fff; color: #0f172a; padding: 0.45rem 0.9rem; border-radius: 14px; box-shadow: 0 18px 36px rgba(0,0,0,0.18); font-weight: 700; }
.owl-cta-image { width: 120px; height: 120px; object-fit: contain; cursor: pointer; transition: transform 0.18s ease, filter 0.18s ease; filter: drop-shadow(0 10px 22px rgba(0,0,0,0.35)); }
.owl-cta-image:hover { transform: translateY(-3px) scale(1.02); }

/* --- Menu Hamburger et Badge --- */
#menu-button-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
#premium-button-container {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1040;
}
.premium-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    background: linear-gradient(120deg, #8b5cf6, #6366f1, #06b6d4);
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.premium-header-btn .bi-gem { font-size: 1.1rem; }
.premium-header-btn .premium-label { font-size: 0.95rem; }
.premium-header-btn:hover,
.premium-header-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(99, 102, 241, 0.45);
    filter: brightness(1.02);
}
.premium-header-btn:active { transform: translateY(0); }
.premium-header-btn.is-active {
    outline: 2px solid rgba(255,255,255,0.6);
    outline-offset: 3px;
}
@media (max-width: 576px) {
    #premium-button-container { left: 0.75rem; top: 0.75rem; }
    .premium-header-btn { padding: 0.45rem 0.9rem; font-size: 0.95rem; }
    #menu-button-container { top: 0.75rem; right: 0.75rem; gap: 0.5rem; }
    #menu-button-container .menu-toggle-btn { width: 46px; height: 46px; font-size: 1.8rem; }
    .theme-toggle { --toggle-width: 54px; --toggle-height: 30px; --toggle-thumb: 24px; }
}
#menu-button-container .menu-toggle-btn {
    font-size: 2rem;
    color: white;
    background-color: rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background-color: red;
    border: 2px solid white;
    border-radius: 50%;
    display: none;
}
.theme-toggle {
    --toggle-width: 64px;
    --toggle-height: 34px;
    --toggle-thumb: 28px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.theme-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.theme-toggle-track {
    position: relative;
    width: var(--toggle-width);
    height: var(--toggle-height);
    border-radius: 999px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #8fd3ff, #ffe08a);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 12px 24px rgba(0,0,0,0.18), inset 0 0 10px rgba(255,255,255,0.55);
    overflow: hidden;
    transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.theme-toggle-thumb {
    position: absolute;
    top: calc((var(--toggle-height) - var(--toggle-thumb)) / 2);
    left: 4px;
    width: var(--toggle-thumb);
    height: var(--toggle-thumb);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 10px 18px rgba(0,0,0,0.25);
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.theme-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 0.85rem;
    line-height: 1;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.theme-toggle-sun {
    color: #ffb703;
    text-shadow: 0 0 8px rgba(255,183,3,0.6);
}
.theme-toggle-moon {
    color: #e0f2ff;
    text-shadow: 0 0 10px rgba(224,242,255,0.7);
    opacity: 0.55;
}
.theme-toggle input:focus-visible + .theme-toggle-track {
    outline: 2px solid rgba(255,255,255,0.65);
    outline-offset: 2px;
}
body.dark-mode .theme-toggle-track {
    background: linear-gradient(135deg, #0b1c3a, #1b4b7a);
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 12px 24px rgba(0,0,0,0.35), inset 0 0 14px rgba(0,0,0,0.35);
}
body.dark-mode .theme-toggle-thumb {
    transform: translateX(calc(var(--toggle-width) - var(--toggle-height)));
    background: #0e1a33;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}
body.dark-mode .theme-toggle-sun {
    opacity: 0.25;
    transform: translateY(1px);
}
body.dark-mode .theme-toggle-moon {
    opacity: 1;
    transform: translateY(-1px);
}
.theme-toggle:hover .theme-toggle-track {
    transform: translateY(-1px);
}
.theme-toggle:active .theme-toggle-track {
    transform: translateY(0);
}

/* --- Menu Latéral (Offcanvas) --- */
.offcanvas { color: #333; border-left: none; }
.offcanvas-header { background: linear-gradient(135deg, #6A11CB, #2575FC); color: white; }
.offcanvas-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.offcanvas-body { display: flex; flex-direction: column; overflow-y: auto; }
#menu-user-info { text-align: center; border-bottom: 1px solid #dee2e6; padding-bottom: 1rem; }
#menu-items .list-group-item { cursor: pointer; font-weight: 500; }
#menu-items .list-group-item i { color: #6c757d; margin-right: 1rem; width: 20px; }
#menu-items .menu-dot {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 10px;
    height: 10px;
    background: red;
    border-radius: 50%;
    display: inline-block;
}
#menu-footer { padding-top: 1rem; margin-top: auto; border-top: 1px solid #dee2e6; }

/* --- Styles des Cartes Catégorie --- */
.category-card { border: none; border-radius: 18px; color: white; padding: 1.25rem; position: relative; overflow: hidden; cursor: pointer; transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; height: 180px; display: flex; flex-direction: column; justify-content: flex-end; }
.category-card:hover { transform: translateY(-5px); box-shadow: 0 12px 22px rgba(0,0,0,0.22); }
.category-card.disabled { opacity: 0.6; cursor: not-allowed; background-color: #AAB5C2 !important; }
.category-card .card-title { font-size: 1.3rem; font-weight: 700; position: static; padding: 0 0.5rem 0.35rem 0.5rem; }
.category-card .card-icon { position: absolute; top: 16px; right: 16px; width: 80px; height: 80px; opacity: 0.9; }
.category-card .soon-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 110px; height: 110px; }

/* --- Styles pour les étapes et écrans --- */
.content-wrapper { display: none; width: 100%; min-height: 80vh; flex-direction: column; justify-content: center; }
.content-wrapper.active { display: flex; animation: fadeIn 0.5s; align-items: center; padding: 1rem 0 3rem; }
.content-step { display: none; max-width: 1200px; margin: 0 auto; width: 100%; padding: clamp(1rem, 2vw, 1.5rem); }
.content-step.active { display: block; }
/* Le chat doit prendre toute la largeur disponible */
#owl-chat-container.content-wrapper { align-items: stretch; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
#results-container.content-wrapper.active { align-items: flex-start; justify-content: flex-start; padding-top: 1.5rem; }
#optionsContainer {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
#custom-builder-container.content-wrapper.active { align-items: stretch; }
#custom-library-container.content-wrapper.active { align-items: stretch; }

/* --- Styles pour les formulaires (Étape 2) --- */
.form-control-lg { border-radius: 12px; }
.form-control-lg:focus { box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.3); border-color: #FFF; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* --- Custom Quiz Builder --- */
.custom-builder-shell { display: flex; flex-direction: column; gap: 1rem; }
.custom-builder-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.custom-builder-header-actions { display: flex; align-items: center; gap: 0.75rem; }
.custom-pill { background: var(--chip-bg); color: var(--text-primary); padding: 0.5rem 0.9rem; border-radius: 999px; font-weight: 700; border: 1px solid var(--chip-border); }
.custom-builder-step { display: none; width: 100%; }
.custom-builder-step.active { display: block; }
.custom-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; }
.custom-type-card { position: relative; padding: 1rem; border-radius: 18px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-primary); box-shadow: 0 16px 38px rgba(15,23,42,0.08); cursor: pointer; overflow: hidden; transition: transform 0.15s ease, box-shadow 0.2s ease; }
.custom-type-card:hover { transform: translateY(-4px); box-shadow: 0 22px 48px rgba(15,23,42,0.12); }
.custom-type-card.selected { box-shadow: 0 26px 56px rgba(15,23,42,0.18); }
.custom-type-card .custom-type-icon { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: rgba(0,0,0,0.06); margin-bottom: 0.35rem; }
.custom-type-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.2rem; }
.custom-type-subtitle { color: var(--text-muted); margin-bottom: 0; }
.custom-type-check { position: absolute; top: 12px; right: 12px; background: var(--card-bg); color: var(--text-primary); border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 18px rgba(0,0,0,0.08); }
.custom-panel { height: 100%; }
.library-panel { min-height: 320px; }
#custom-library-list { display: flex; flex-direction: column; gap: 0.75rem; }
.custom-library-card { border: 1px solid var(--border-color); border-radius: 16px; padding: 0.9rem 1rem; background: var(--card-bg); box-shadow: 0 14px 32px rgba(15,23,42,0.08); }
.custom-library-title { font-weight: 700; color: var(--text-primary); margin-bottom: 0.15rem; }
.custom-library-meta { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 0.6rem; }
.custom-library-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.custom-library-empty { border: 1px dashed var(--border-color); padding: 1rem; border-radius: 14px; background: var(--soft-surface); color: var(--text-secondary); text-align: left; }
.custom-editor-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.custom-chip { background: var(--border-color); color: var(--text-primary); border-radius: 999px; padding: 0.4rem 0.9rem; font-weight: 700; }
.custom-meta-card { background: var(--chip-bg); border: 1px solid var(--chip-border); border-radius: 14px; padding: 0.9rem 1rem; text-align: left; }
.custom-meta-label { color: var(--text-muted); font-size: 0.9rem; }
.custom-meta-value { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); margin: 0; }
.custom-items-list { display: flex; flex-direction: column; gap: 0.75rem; }
.custom-item-card { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.9rem 1rem; border-radius: 16px; border: 1px solid var(--border-color); background: var(--card-bg); box-shadow: 0 16px 36px rgba(15,23,42,0.08); }
.custom-item-index { width: 42px; height: 42px; border-radius: 14px; background: var(--chip-bg); color: var(--text-primary); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.custom-item-body { flex: 1; }
.custom-item-title { margin: 0; font-weight: 700; color: var(--text-primary); }
.custom-item-subtitle { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.95rem; }
.custom-item-actions { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-end; }
.custom-reorder { display: flex; gap: 0.25rem; }
.custom-empty-state .custom-empty-card { text-align: center; padding: 1.5rem; border: 1px dashed var(--border-color); background: var(--soft-surface); border-radius: 16px; color: var(--text-secondary); }
.custom-empty-icon { width: 54px; height: 54px; margin: 0 auto 0.75rem; border-radius: 14px; background: var(--chip-bg); display: flex; align-items: center; justify-content: center; color: #6A11CB; font-size: 1.4rem; }
.custom-sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: -100%; width: min(100%, 760px); background: var(--card-bg); color: var(--text-primary); border-radius: 24px 24px 0 0; box-shadow: 0 -22px 60px rgba(0,0,0,0.35); padding: 1.25rem 1.25rem 1.1rem; z-index: 1060; transition: bottom 0.25s ease; max-height: 92vh; overflow-y: auto; }
.custom-sheet.active { bottom: 0; }
.custom-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.custom-sheet-body { display: flex; flex-direction: column; gap: 0.85rem; }
.custom-sheet-footer { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; flex-wrap: wrap; }
.custom-sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1050; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.custom-sheet-backdrop.active { opacity: 1; pointer-events: all; }
.custom-option-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 0.75rem; border: 1px solid var(--border-color); border-radius: 12px; background: var(--surface-bg); }
.custom-option-row .form-control { background: transparent; border: none; border-left: 1px solid var(--border-color); border-radius: 0; padding-left: 0.75rem; }
.custom-option-row .form-control:focus { box-shadow: none; }
.custom-mcq-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.custom-helper { color: var(--text-eyebrow); font-size: 0.92rem; }
.custom-field-group label { font-weight: 600; color: var(--text-primary); }
.custom-field-group .form-control { border-radius: 12px; }
#custom-items-list .btn-icon, .custom-item-actions .btn-icon { padding: 0.35rem 0.55rem; border-radius: 10px; }
@media (max-width: 767px) {
    .custom-builder-header { align-items: flex-start; }
    .custom-builder-header-actions { width: 100%; justify-content: flex-start; }
    .custom-item-card { flex-direction: column; }
    .custom-item-actions { width: 100%; flex-direction: row; justify-content: flex-end; }
}

#custom-library-container .surface-panel { margin-top: 0.5rem; }

/* --- Tutor Owl Bubble --- */
.tutor-bubble { display: inline-flex; align-items: flex-start; gap: 0.6rem; margin-top: 0.35rem; flex-wrap: wrap; }
.tutor-avatar { width: 52px; height: 52px; border-radius: 16px; border: 1px solid #e2e8f0; background: #f8fafc; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 12px 26px rgba(15,23,42,0.08); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.tutor-avatar img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.18)); }
.tutor-avatar:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15,23,42,0.2); }
.tutor-dialog { position: relative; max-width: 520px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 0.85rem 1rem; box-shadow: 0 18px 42px rgba(15,23,42,0.12); color: #0f172a; }
.tutor-dialog p { margin: 0; color: #334155; }
.tutor-dialog h6 { margin: 0 0 0.25rem 0; font-weight: 700; color: #0f172a; }
.tutor-dialog::before { content: ''; position: absolute; left: -8px; top: 16px; width: 16px; height: 16px; background: #fff; border-left: 1px solid #e2e8f0; border-top: 1px solid #e2e8f0; transform: rotate(-45deg); box-shadow: -5px 5px 12px rgba(15,23,42,0.05); }
.tutor-bubble.open .tutor-avatar { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(15,23,42,0.2); }
.tutor-cta-label { font-size: 0.9rem; color: #475569; margin-bottom: 0.15rem; }
.quiz-score-summary { display: flex; align-items: center; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.quiz-score-circle { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, #6A11CB, #2575FC); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 800; box-shadow: 0 18px 38px rgba(15,23,42,0.18); }
.quiz-score-copy { text-align: left; color: var(--text-secondary); }
.tutor-bubble-row { display: flex; justify-content: flex-start; margin-top: 0.75rem; }

/* --- Styles pour l'écran de chargement stylé --- */
#stylish-loading-container { display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; height: 100%; }
#stylish-loading-container.active { display: flex; }
#stylish-loading-container .loading-view, 
#stylish-loading-container .error-view { width: 100%; max-width: 600px; }
.progress-bar-container { width: 100%; height: 12px; background-color: rgba(255, 255, 255, 0.2); border-radius: 6px; overflow: hidden; }
.progress-bar-inner { width: 0%; height: 100%; background-color: white; border-radius: 6px; transition: width 0.3s ease-in-out; }
#cancel-button { width: 80%; max-width: 300px; margin-top: 2rem; }
.scanned-pdf-info { background-color: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 1rem; display: flex; align-items: center; gap: 1rem; border: 1px solid rgba(255, 255, 255, 0.3); }
.scanned-pdf-info i { font-size: 1.5rem; color: #ffc107; }
.scanned-pdf-info p { margin: 0; text-align: left; font-size: 0.9rem; }
.scanned-pdf-info a { color: #ffc107; text-decoration: underline; font-weight: bold; cursor: pointer; }
#loading-game-canvas { background-color: rgba(0, 0, 0, 0.6); border-radius: 16px; border: 1.5px solid rgba(100, 181, 246, 0.5); cursor: ew-resize; }

/* --- Styles pour la modale de saisie de texte --- */
#textInputModal .modal-content { background: #2c3e50; color: white; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.2); }
#textInputModal .modal-header,
#textInputModal .modal-footer { border-bottom: 1px solid rgba(255, 255, 255, 0.1); border-top: 1px solid rgba(255, 255, 255, 0.1); }
#textInputModal .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
#textInputModal #text-input-area { background-color: rgba(0, 0, 0, 0.2); color: white; border: 1px solid rgba(255, 255, 255, 0.3); }
#textInputModal #text-input-area:focus { background-color: rgba(0, 0, 0, 0.3); color: white; border-color: #86b7fe; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); }

/* --- Styles pour les vues de RÉSULTATS --- */
.results-view-container { max-width: 1100px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 1.5rem; }
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; color: var(--text-primary); width: 100%; flex-wrap: wrap; gap: 0.75rem; }
.results-header-left { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.results-title { font-size: 1.65rem; font-weight: 800; margin: 0; letter-spacing: 0.01em; }
.results-meta { background-color: var(--chip-bg); border: 1px solid var(--chip-border); border-radius: 12px; padding: 0.4rem 0.75rem; font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.results-toolbar { display: flex; align-items: center; gap: 0.5rem; }
.results-toolbar .btn { background-color: var(--chip-bg); color: var(--text-primary); border: 1px solid var(--chip-border); box-shadow: 0 6px 16px rgba(15,23,42,0.08); }
.results-toolbar .btn:hover { background-color: var(--surface-bg); color: var(--text-primary); border-color: var(--border-color); }
.results-actions { display: flex; justify-content: center; gap: 1rem; margin-top: 1.25rem; flex-wrap: wrap; }
.results-card-shell { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 22px; padding: clamp(1rem, 2vw, 1.75rem); box-shadow: 0 20px 48px rgba(15,23,42,0.12); color: var(--text-primary); }
.results-home-btn { width: 48px; height: 48px; border-radius: 14px; background: var(--chip-bg); border: 1px solid var(--chip-border); color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 8px 18px rgba(15,23,42,0.1); }
.results-home-btn:hover { background: var(--surface-bg); color: var(--text-primary); }
.results-paginator { display: flex; justify-content: center; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.results-paginator .btn-nav { min-width: 56px; min-height: 56px; font-size: 1.5rem; border-radius: 16px; background: var(--chip-bg); color: var(--text-primary); border: 1px solid var(--chip-border); box-shadow: 0 10px 24px rgba(15,23,42,0.12); }
.results-paginator .counter { color: var(--text-primary); font-weight: 700; font-size: 1.1rem; padding: 0.4rem 0.9rem; background: var(--chip-bg); border-radius: 999px; border: 1px solid var(--border-color); }
.results-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; align-items: center; }
.results-cta .btn { min-width: 200px; }
.surface-panel .btn-outline-light {
    color: #0f172a;
    border-color: #e2e8f0;
}
.surface-panel .btn-outline-light:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* Analysis modal */
.analysis-modal { background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 20px; box-shadow: 0 20px 48px rgba(15,23,42,0.12); }
.analysis-modal .modal-header,
.analysis-modal .modal-footer { border-color: var(--border-color); }
.analysis-modal-footer { gap: 0.5rem; }
.analysis-summary { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.analysis-stat { background: var(--chip-bg); border: 1px solid var(--chip-border); border-radius: 14px; padding: 0.75rem 1rem; min-width: 150px; flex: 1 1 150px; }
.analysis-stat strong { display: block; font-size: 1.1rem; color: var(--text-primary); }
.analysis-stat span { color: var(--text-secondary, #475569); font-size: 0.9rem; }
.analysis-list { display: grid; gap: 0.75rem; margin-top: 1rem; }
.analysis-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 0.85rem 1rem; box-shadow: 0 12px 28px rgba(15,23,42,0.08); display: flex; flex-direction: column; gap: 0.5rem; }
.analysis-card.is-clickable { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.analysis-card.is-clickable:hover { transform: translateY(-1px); box-shadow: 0 16px 32px rgba(15,23,42,0.12); }
.analysis-card-title { font-weight: 700; margin: 0; color: var(--text-primary); }
.analysis-card-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--text-secondary, #475569); }
.analysis-meter { height: 6px; border-radius: 999px; background: rgba(15,23,42,0.08); overflow: hidden; }
.analysis-meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, #6A11CB, #2575FC); }
.analysis-locked { text-align: center; padding: 2rem 1rem; }
.analysis-locked i { font-size: 2rem; color: #f59e0b; }
.analysis-locked h6 { font-weight: 800; margin-top: 0.75rem; }
.analysis-locked p { color: var(--text-secondary, #475569); margin-bottom: 0; }

/* Styles spécifiques au Quiz */
.quiz-card { background: white; color: #333; padding: clamp(1.25rem, 2vw, 2rem); border-radius: 22px; margin-bottom: 1.25rem; width: 100%; box-shadow: 0 16px 40px rgba(0,0,0,0.12); border: 1px solid rgba(0,0,0,0.04); }
.quiz-card-title { color: #6A11CB; font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: 0.5rem; }
.quiz-actions-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: center; margin-top: 0.5rem; }
.quiz-add-more { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.quiz-add-more .btn { min-width: 110px; }
.quiz-view-toggle { display: inline-flex; gap: 0.35rem; background: #eef2ff; border-radius: 12px; padding: 0.25rem; border: 1px solid #dbeafe; }
.quiz-view-toggle button { border: none; background: transparent; color: #0f172a; padding: 0.35rem 0.8rem; border-radius: 10px; font-weight: 600; }
.quiz-view-toggle button.active { background: #dbeafe; font-weight: 800; }

/* CORRECTION pour la largeur des boutons */
.options-list {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem; /* Remplace margin-bottom pour un meilleur espacement */
}
.option-item {
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    /* margin-bottom est maintenant géré par 'gap' dans le parent */
    border-radius: 14px;
    padding: 0.95rem 1.1rem;
    cursor: pointer;
    transition: transform 0.12s ease-in-out, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    width: 100%; /* S'assure que l'item prend toute la largeur du conteneur flex */
    box-sizing: border-box; /* Inclut padding et border dans la largeur totale */
    text-align: left; /* Garde le texte aligné à gauche */
    font-size: 1.05rem;
}
/* FIN DE LA CORRECTION */

.option-item:hover:not(.answered) { transform: scale(1.015); border-color: #6A11CB; box-shadow: 0 10px 25px rgba(106,17,203,0.12); }
.option-item.answered { cursor: not-allowed; pointer-events: none; }
.option-item.correct { background-color: #d1e7dd; border-color: #0f5132; color: #0f5132; font-weight: bold; }
.option-item.incorrect { background-color: #f8d7da; border-color: #842029; color: #842029; font-weight: bold; }
.option-item.selected { background-color: #e7f1ff; border-color: #0d6efd; color: #0d6efd; }

/* Styles spécifiques au Résumé */
.summary-card { background: white; color: #333; padding: 2rem; border-radius: 20px; line-height: 1.8; }
.summary-card-title { color: #6A11CB; font-weight: bold; margin-bottom: 1rem; }
.summary-card p { font-size: 1.05rem; }

/* Styles spécifiques aux Flashcards */
.flashcard-container { perspective: 1000px; width: 100%; max-width: 620px; height: 360px; cursor: pointer; }
.flashcard { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.6s; border-radius: 20px; }
.flashcard.is-flipped { transform: rotateY(180deg); }
.flashcard-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px; background-color: white; color: #333; display: flex; align-items: center; justify-content: center; padding: 2rem; font-size: 1.5rem; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.flashcard-back { transform: rotateY(180deg); background-color: #e9ecef; }
.flashcard-nav { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 600px; margin-top: 1rem; }
.flashcard-nav .btn { font-size: 2rem; background: #eef2ff; border: 1px solid #dbeafe; color: #0f172a; border-radius: 14px; padding: 0.35rem 0.75rem; box-shadow: 0 10px 22px rgba(15,23,42,0.12); }
.flashcard-counter { font-size: 1.2rem; font-weight: 500; }
.flashcard-wrapper { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.flashcard-swipe-hint { margin: 0.35rem 0 0.1rem; font-size: 0.95rem; color: #64748b; text-align: center; }

/* Styles spécifiques au Texte à trous */
.fill-blank-input { border: 2px solid #dee2e6; border-radius: 12px; padding: 0.75rem 1rem; font-size: 1rem; width: 100%; margin-top: 1rem; }
.fill-blank-input:focus { outline: none; border-color: #6A11CB; box-shadow: 0 0 0 0.25rem rgba(106, 17, 203, 0.25); }
.fill-blank-input.correct { border-color: #198754; background-color: #d1e7dd; }
.fill-blank-input.incorrect { border-color: #dc3545; background-color: #f8d7da; }
.fill-blank-feedback { margin-top: 0.5rem; font-weight: bold; height: 24px; }
.fill-blank-feedback.correct { color: #198754; }
.fill-blank-feedback.incorrect { color: #dc3545; }

/* --- Écran Quiz sauvegardés (web) --- */
.saved-screen { width: 100%; max-width: 1200px; margin: 0 auto; color: #0f172a; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 22px; padding: 1.25rem; box-shadow: 0 22px 46px rgba(15,23,42,0.12); }
.saved-screen__header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.saved-eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; color: #6b7280; font-weight: 700; }
.saved-title { font-weight: 800; font-size: clamp(1.7rem, 2vw, 2rem); color: #0f172a; }
.saved-subtitle { color: #1f2937; max-width: 720px; font-weight: 600; }
.saved-back-btn { width: 52px; height: 52px; border-radius: 14px; border: 1px solid #e2e8f0; color: #0f172a; background: #ffffff; box-shadow: 0 8px 18px rgba(15,23,42,0.08); }
.saved-header-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.saved-toggle { display: inline-flex; border-radius: 14px; border: 1px solid #e2e8f0; background: #f8fafc; overflow: hidden; }
.saved-toggle-btn { border: none; background: transparent; color: #0f172a; padding: 0.55rem 0.9rem; min-width: 44px; }
.saved-toggle-btn.active { background: linear-gradient(135deg, #eef2ff, #e0f2fe); color: #0f172a; font-weight: 700; }
.saved-sort { display: inline-flex; gap: 0.35rem; }
.saved-sort-btn { border-radius: 14px !important; border: 1px solid #e2e8f0; background: #f8fafc; color: #0f172a; display: inline-flex; align-items: center; gap: 0.35rem; }
.saved-add-folder { border-radius: 14px; box-shadow: 0 12px 24px rgba(15,23,42,0.08); display: inline-flex; align-items: center; gap: 0.35rem; }
.saved-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.saved-stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 0.9rem 1rem; display: flex; align-items: center; gap: 0.65rem; box-shadow: 0 12px 28px rgba(15,23,42,0.08); }
.saved-stat-card .icon { width: 42px; height: 42px; border-radius: 12px; background: #eef2ff; color: #4f46e5; display: grid; place-items: center; font-size: 1.25rem; }
.saved-stat-card strong { display: block; font-size: 1.05rem; color: #0f172a; }
.saved-stat-card span { color: #475569; font-size: 0.92rem; }
.saved-folders-list { display: flex; flex-direction: column; gap: 1rem; width: 100%; }
.saved-folder-card { position: relative; background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 1rem 1rem 0.75rem; box-shadow: 0 14px 32px rgba(15,23,42,0.08); }
.saved-folder-card.dragging { border-color: #cbd5e1; box-shadow: 0 18px 36px rgba(15,23,42,0.12); }
.saved-folder-card:hover { border-color: #cbd5e1; box-shadow: 0 16px 30px rgba(15,23,42,0.1); cursor: pointer; transform: translateY(-1px); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.saved-folder-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.saved-folder-head { cursor: pointer; }
.saved-folder-icon { width: 42px; height: 42px; border-radius: 12px; background: #f1f5f9; display: grid; place-items: center; font-size: 1.2rem; color: #eab308; }
.saved-folder-title { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; color: #0f172a; }
.saved-folder-badge { background: #f8fafc; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.85rem; font-weight: 600; }
.saved-folder-actions { margin-left: auto; display: inline-flex; gap: 0.35rem; }
.saved-folder-actions .btn { padding: 0.35rem 0.75rem; border-radius: 12px; border: 1px solid #e2e8f0; color: #0f172a; background: #f8fafc; }
.saved-type-block { background: #f8fafc; border: 1px dashed #e2e8f0; border-radius: 14px; padding: 0.75rem; margin-bottom: 0.6rem; }
.saved-type-block:hover { border-color: #cbd5e1; box-shadow: 0 10px 20px rgba(15,23,42,0.06); cursor: pointer; transform: translateY(-1px); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.saved-type-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.saved-type-head { cursor: pointer; }
.saved-type-chip { background: #eef2ff; border-radius: 10px; padding: 0.35rem 0.65rem; display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: #0f172a; }
.saved-type-count { color: #475569; font-size: 0.9rem; }
.saved-type-drag { color: #94a3b8; cursor: grab; }
.saved-type-drag:hover { color: #1f2937; }
.saved-type-actions .btn { border-color: #e2e8f0; color: #0f172a; background: #f8fafc; }
.saved-folder-body { padding-left: 0.3rem; }
.saved-folder-toggle,
.saved-type-toggle { border: 1px solid #e2e8f0; background: #f8fafc; color: #0f172a; border-radius: 10px; width: 32px; height: 32px; display: grid; place-items: center; }
.saved-quiz-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 0.75rem 0.9rem; margin-bottom: 0.5rem; display: flex; gap: 0.75rem; align-items: center; box-shadow: 0 10px 22px rgba(15,23,42,0.06); }
.saved-quiz-card:hover { border-color: #cbd5e1; box-shadow: 0 12px 26px rgba(15,23,42,0.1); cursor: pointer; }
.saved-quiz-title { font-weight: 700; margin: 0; color: #0f172a; }
.saved-quiz-meta { color: #475569; font-size: 0.9rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.saved-quiz-actions { margin-left: auto; display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }
.saved-quiz-actions .btn { border-radius: 10px; padding: 0.35rem 0.65rem; border: 1px solid #e2e8f0; color: #0f172a; background: #f8fafc; }
.saved-quiz-actions .btn-primary { background: linear-gradient(135deg, #6A11CB, #2575FC); border: none; color: #fff; }
.saved-quiz-actions .btn-danger { border-color: #fecdd3; color: #b91c1c; background: #fff5f5; }
.saved-quiz-drag { color: #94a3b8; cursor: grab; font-size: 1.1rem; }
.saved-quiz-drag:hover { color: #1f2937; }
.saved-empty-state { width: 100%; display: flex; justify-content: center; margin-top: 2rem; }
.saved-empty-card { max-width: 680px; background: #fff; border: 1px solid #e2e8f0; padding: 2rem; border-radius: 20px; text-align: center; box-shadow: 0 16px 36px rgba(15,23,42,0.08); color: #0f172a; }
.saved-empty-card h3 { font-weight: 800; margin-bottom: 0.5rem; }
.saved-empty-card p { color: #475569; margin-bottom: 1rem; }
.saved-empty-icon { width: 80px; height: 80px; border-radius: 20px; background: #f1f5f9; display: grid; place-items: center; margin: 0 auto 1rem; font-size: 2rem; color: #eab308; }
.saved-folder-handle { cursor: grab; opacity: 0.75; }
.saved-inline-alert { color: #ff9f43; font-size: 0.9rem; margin: 0.25rem 0 0.5rem; }
.saved-note { color: #475569; font-size: 0.9rem; margin-top: 0.4rem; }
.saved-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; width: 100%; }
.saved-grid-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1rem; box-shadow: 0 16px 32px rgba(15,23,42,0.08); display: flex; flex-direction: column; gap: 0.35rem; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.saved-grid-card:hover { border-color: #cbd5e1; box-shadow: 0 18px 32px rgba(15,23,42,0.12); cursor: pointer; transform: translateY(-1px); }
.saved-grid-title { color: #0f172a; font-weight: 700; }
.saved-grid-meta { color: #475569; font-size: 0.92rem; }
.drag-ghost { opacity: 0.6; }
.saved-grid-card .saved-grid-drag { align-self: flex-end; color: #94a3b8; cursor: grab; }
.saved-grid-card .saved-grid-drag:hover { color: #1f2937; }
.saved-grid-breadcrumb { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.75rem; }
.saved-grid-path .crumb { font-weight: 700; color: #0f172a; }
.saved-grid-path { display: inline-flex; align-items: center; gap: 0.35rem; }
.saved-breadcrumb-back { border-radius: 12px; border: 1px solid #e2e8f0; background: #fff; color: #0f172a; box-shadow: 0 10px 20px rgba(15,23,42,0.08); }
.saved-inline-folder-banner { margin-bottom: 0.75rem; }

/* --- Historique (web) --- */
.history-screen { background: linear-gradient(180deg, #f8fafc 0%, #ffffff 65%); }
.history-actions .btn { border-radius: 12px; }
.history-meta-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.history-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #eef2ff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
    color: #0f172a;
    font-size: 0.92rem;
    cursor: pointer;
}
.history-pill i { color: #6A11CB; }
.history-pill.active {
    background: linear-gradient(135deg, #eef2ff, #e0f2fe);
    border-color: #cbd5e1;
    box-shadow: 0 10px 22px rgba(15,23,42,0.08);
}
.history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.history-card.saved-quiz-card { align-items: flex-start; gap: 0.9rem; cursor: pointer; }
.history-card .history-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    color: #0f172a;
    box-shadow: 0 10px 22px rgba(15,23,42,0.08);
    flex-shrink: 0;
}
.history-card .history-card-body { flex: 1; }
.history-card .history-title { margin: 0; font-weight: 800; color: #0f172a; }
.history-card .history-preview { margin: 0.15rem 0 0; color: #475569; }
.history-card .history-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.history-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.3rem 0.6rem;
    font-weight: 600;
    color: #0f172a;
    font-size: 0.9rem;
}
.history-chip--muted { background: #f1f5f9; color: #475569; }
.history-date { color: #64748b; font-weight: 600; font-size: 0.92rem; }
.history-actions { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }
.history-actions .btn { border-radius: 10px; padding: 0.45rem 0.7rem; }
.history-actions .btn-primary { background: linear-gradient(135deg, #6A11CB, #2575FC); border: none; }
.history-card:hover .history-title { color: #6A11CB; }

@media (max-width: 768px) {
    .saved-screen__header { flex-direction: column; align-items: flex-start; }
    .saved-header-actions { width: 100%; justify-content: flex-start; }
    .saved-quiz-card { align-items: flex-start; flex-direction: column; }
    .saved-quiz-actions { width: 100%; justify-content: flex-start; }
}

/* --- Modale de sauvegarde (quiz) --- */
.save-modal-body { background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%); }
.save-modal-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1rem; box-shadow: 0 10px 22px rgba(15,23,42,0.06); margin-bottom: 0.75rem; }
.save-modal-eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; color: #6b7280; font-weight: 700; }
.save-modal-title { font-weight: 800; color: #0f172a; }
.save-modal-help { color: #475569; font-size: 0.9rem; }
.save-modal-badge { background: #eef2ff; color: #4f46e5; border-radius: 999px; padding: 0.25rem 0.7rem; font-weight: 700; font-size: 0.85rem; }
.save-folder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.65rem; margin-top: 0.35rem; }
.save-folder-card { border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 14px; padding: 0.75rem; display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; transition: all 0.15s ease; color: #0f172a; }
.save-folder-card:hover { border-color: #cbd5e1; box-shadow: 0 10px 22px rgba(15,23,42,0.08); }
.save-folder-card.active { background: linear-gradient(135deg, #eef2ff, #e0f2fe); border-color: #a5b4fc; box-shadow: 0 12px 26px rgba(79,70,229,0.18); }
.save-folder-icon { width: 40px; height: 40px; border-radius: 12px; background: #fff; display: grid; place-items: center; color: #eab308; font-size: 1.2rem; }
.save-folder-name { font-weight: 700; flex: 1; }
.save-folder-count { color: #475569; font-size: 0.9rem; }
.save-inline-folder .input-group-text { background: #f8fafc; border-color: #e2e8f0; }
.save-inline-folder .form-control { border-color: #e2e8f0; }
.save-inline-folder .btn-light { border-color: #e2e8f0; color: #475569; }
#saved-stats-row { display: none; }

/* NOUVEAU: Styles spécifiques au Vocabulaire */
.vocab-card {
    background: white;
    color: #333;
    padding: clamp(1.5rem, 2vw, 2.4rem);
    border-radius: 20px;
    text-align: center;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 18px 45px rgba(0,0,0,0.12);
}
.vocab-word-to-translate {
    font-size: 2.8rem;
    font-weight: 600;
    color: #6A11CB;
    margin-bottom: 1.5rem;
}
.vocab-input-group {
    display: flex;
    gap: 0.5rem;
}
.vocab-input {
    flex-grow: 1;
    border-radius: 12px !important; /* Forcer le radius */
}


/* --- Styles génériques & Boutons d'étapes --- */
.btn-lg { padding: 0.85rem 1.35rem; font-size: 1.15rem; font-weight: 600; border-radius: 16px; }
.btn-light { font-weight: 600; color: var(--button-light-text); background-color: var(--button-light-bg); border-color: var(--button-light-border); }
.btn-light-transparent { background-color: var(--button-light-bg); color: var(--text-primary); border-color: var(--button-light-border); box-shadow: 0 8px 18px rgba(15,23,42,0.12); }
.btn-light-transparent:hover { background-color: var(--surface-bg); color: var(--text-primary); border-color: var(--border-color); }
.action-btn {
    background-color: rgba(255, 255, 255, 0.92);
    color: #2b0b68;
    font-weight: 700;
    font-size: 1.15rem;
    padding: 1.1rem 1.35rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease-in-out;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    min-height: 76px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.08);
}
.action-btn:hover { background-color: #fff; color: #6A11CB; transform: translateY(-4px); box-shadow: 0 6px 18px rgba(0,0,0,0.15); }
.action-btn i { font-size: 1.45rem; background: linear-gradient(135deg, #6A11CB, #2575FC); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-fill-color: transparent; }
.action-btn span { flex: 1; text-align: center; }
.question-count-btn { font-size: 1.35rem; letter-spacing: 0.02em; }

/* --- Instructions personnalisées --- */
.instruction-panel {
    position: relative;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 22px;
    padding: 1.25rem 1.35rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 36px rgba(15,23,42,0.12);
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.instruction-panel:hover { transform: translateY(-2px); border-color: #dbeafe; box-shadow: 0 24px 54px rgba(15,23,42,0.14); }
.instruction-panel::before {
    content: "";
    position: absolute;
    top: -30%;
    left: -10%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle at 35% 35%, rgba(147, 165, 255, 0.25), transparent 55%);
    opacity: 0.9;
    pointer-events: none;
}
.instruction-panel__header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.instruction-panel__actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.instruction-panel-title {
    font-weight: 800;
    font-size: 1.15rem;
    margin-bottom: 0.15rem;
    color: #0f172a;
}
.instruction-panel-subtitle {
    color: #475569;
    font-size: 0.95rem;
}
.instruction-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(120deg, #8c78ff, #4f8bff);
    color: white;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}
.instruction-panel__body {
    position: relative;
    z-index: 1;
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.instruction-add-btn {
    border: 1px solid #dbeafe;
    background: linear-gradient(135deg, #93a5ff, #6a11cb);
    color: white;
    font-weight: 700;
    padding: 0.55rem 1rem;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow: 0 14px 30px rgba(15,23,42,0.16);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
    cursor: pointer;
}
.instruction-add-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(15,23,42,0.18); }
.instruction-add-btn i { font-size: 1rem; }
.instruction-clear-link {
    background: #eef2ff;
    border: 1px solid #dbeafe;
    color: #0f172a;
    border-radius: 12px;
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}
.instruction-clear-link:hover { background: #e0e7ff; color: #0f172a; border-color: #cbd5e1; }
.instruction-clear-link.disabled,
.instruction-clear-link:disabled { opacity: 0.4; pointer-events: none; }
.instruction-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}
.instruction-chip {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.5rem 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: #0f172a;
    box-shadow: 0 10px 20px rgba(15,23,42,0.08);
}
.instruction-chip-remove {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    padding: 0;
}
.instruction-chip-remove i { pointer-events: none; }
.instruction-empty {
    color: #6b7280;
    margin: 0;
    font-size: 0.95rem;
}
.instruction-panel__note {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #0f172a;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}
.instruction-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.instruction-suggestion {
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 0.5rem 0.95rem;
    background: linear-gradient(135deg, #eef2ff, #e0f2fe);
    color: #0f172a;
    font-size: 0.92rem;
    transition: border-color 0.2s ease, transform 0.15s ease, background-color 0.15s ease;
}
.instruction-suggestion:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}
.instruction-modal-intro {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
}
.instruction-modal-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8c78ff, #4f8bff);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}

/* --- Bloc Options avancées --- */
.advanced-options-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding: 1rem 1.1rem;
    box-shadow: 0 20px 46px rgba(15,23,42,0.1);
}
.advanced-options-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    padding: 0.35rem 0.2rem;
    user-select: none;
}
.advanced-options-header:focus { outline: none; }
.advanced-options-header .toggle-icon { transition: transform 0.18s ease; color: #0f172a; }
.advanced-options-header[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }
.advanced-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8c78ff, #4f8bff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    box-shadow: 0 12px 28px rgba(0,0,0,0.2);
}
.advanced-title {
    color: #0f172a;
    font-weight: 800;
    letter-spacing: 0.01em;
}
.advanced-subtitle {
    color: #475569;
    font-size: 0.93rem;
}
.advanced-meta {
    color: #0f172a;
    text-align: right;
}
.advanced-options-body {
    margin-top: 0.4rem;
    padding: 0.9rem 0.25rem 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.adv-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #eef2ff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.92rem;
    color: #0f172a;
}
.adv-pill.pill-active {
    border-color: #93a5ff;
    background: #e0e7ff;
    color: #0f172a;
}
.adv-pill.pill-locked {
    border-color: rgba(255, 197, 124, 0.7);
    background: #fef3c7;
    color: #92400e;
}

/* --- Tutor Mode Toggle --- */
.tutor-card {
    position: relative;
    background: linear-gradient(135deg, #f8fafc, #ffffff);
    border-radius: 24px;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    box-shadow: 0 22px 48px rgba(15,23,42,0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.tutor-card::before {
    content: "";
    position: absolute;
    right: -18%;
    top: -25%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle at 50% 40%, rgba(80, 227, 194, 0.32), transparent 55%);
    pointer-events: none;
}
.tutor-card:hover { transform: translateY(-2px); box-shadow: 0 26px 56px rgba(15,23,42,0.16); border-color: #dbeafe; }
.tutor-icon-bubble {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, #50e3c2, #2b7be4);
    color: #0b0f1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 16px 30px rgba(0,0,0,0.25);
    z-index: 1;
}
.tutor-card-content {
    flex: 1;
    z-index: 1;
}
.tutor-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    color: #6a11cb;
}
.tutor-card h5 {
    color: #0f172a;
    margin: 0;
    font-weight: 700;
}
.tutor-card p {
    margin: 0.35rem 0 0;
    color: #475569;
    font-size: 0.95rem;
}
.tutor-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #8c78ff, #4f8bff);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.85rem;
    color: white;
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 10px 22px rgba(0,0,0,0.22);
}
.tutor-pill.pill-muted {
    background: linear-gradient(135deg, #6c6f7b, #4f5361);
}
.tutor-toggle-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    min-width: 170px;
    z-index: 1;
}
.tutor-toggle-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 12px;
    border: 1px solid #dbeafe;
    color: #0f172a;
    background: #eef2ff;
    font-weight: 600;
}
.tutor-toggle-status.active {
    border-color: rgba(80,227,194,0.65);
    color: #065f46;
    background: rgba(80,227,194,0.2);
}
.tutor-subline { color: #475569; font-size: 0.93rem; }
.tutor-card .form-switch {
    margin: 0;
}
.tutor-card .form-check-input {
    width: 3.2rem;
    height: 1.65rem;
    background-color: #e2e8f0;
    border: 1px solid #cbd5e1;
    cursor: pointer;
}
.tutor-card .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(147, 165, 255, 0.35);
}
.tutor-card .form-check-input:checked {
    background-color: #50e3c2;
    border-color: #50e3c2;
    box-shadow: 0 0 0 0.2rem rgba(80, 227, 194, 0.25);
}
.tutor-warning {
    font-size: 0.9rem;
    color: #f59e0b;
    margin-top: 0.35rem;
}

/* --- Support chat (web) --- */
#support-container.content-wrapper { align-items: stretch; }
.support-shell { width: 100%; max-width: 1100px; margin: 0 auto; background: rgba(255,255,255,0.97); color: #0f172a; border-radius: 24px; padding: clamp(1rem, 2vw, 1.5rem); box-shadow: 0 24px 52px rgba(15,23,42,0.14); display: flex; flex-direction: column; gap: 1rem; }
.support-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; }
.support-eyebrow { letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: #64748b; font-size: 0.85rem; }
.support-title { font-weight: 800; }
.support-subtitle { color: #475569; max-width: 640px; margin: 0; }
.support-header-actions { display: flex; gap: 0.65rem; align-items: center; flex-wrap: wrap; }
.support-body { background: #f3f5fb; border: 1px solid #dce3ef; border-radius: 20px; padding: 1rem; min-height: 320px; max-height: 60vh; overflow-y: auto; }
.support-messages { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; }
.support-row { display: flex; align-items: flex-start; gap: 0.65rem; width: 100%; }
.support-row.user { justify-content: flex-end; }
.support-avatar { width: 40px; height: 40px; border-radius: 12px; background: #eef2ff; color: #4f46e5; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 22px rgba(79,70,229,0.18); flex-shrink: 0; }
.support-bubble { padding: 0.85rem 1rem; border-radius: 16px; max-width: min(78%, 760px); box-shadow: 0 10px 22px rgba(15,23,42,0.08); line-height: 1.5; border: 1px solid #e2e8f0; background: #ffffff; }
.support-bubble.user { background: linear-gradient(135deg, #6A11CB, #2575FC); color: #fff; border: none; border-bottom-right-radius: 10px; }
.support-bubble.admin { border-bottom-left-radius: 10px; }
.support-meta { margin-top: 0.35rem; font-size: 0.85rem; opacity: 0.75; }
.support-image { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.35rem; }
.support-image img { max-width: 200px; border-radius: 12px; border: 1px solid #e5e7eb; box-shadow: 0 10px 18px rgba(15,23,42,0.12); }
.support-image a { font-weight: 600; color: #4f46e5; text-decoration: none; }
.support-input { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.support-input-row .form-control { border-radius: 14px 0 0 14px; }
.support-input-row .btn { border-radius: 0 14px 14px 0; display: inline-flex; align-items: center; justify-content: center; }
.support-attachment { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.support-empty { text-align: center; color: #94a3b8; padding: 1rem 0; }
.support-hint { color: #64748b; font-size: 0.92rem; }

/* --- Hibou tuteur (chat web) --- */
.owl-chat-shell { width: 100%; max-width: 1100px; margin: 0 auto; background: rgba(255,255,255,0.98); color: #0f172a; border-radius: 24px; padding: clamp(1rem, 2vw, 1.5rem); box-shadow: 0 26px 60px rgba(0,0,0,0.18); display: flex; flex-direction: column; gap: 1rem; }
.owl-chat-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; }
.owl-chat-eyebrow { letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: #64748b; font-size: 0.85rem; }
.owl-chat-title { font-weight: 800; }
.owl-chat-subtitle { color: #475569; max-width: 640px; }
.owl-chat-header-actions { display: flex; gap: 0.65rem; align-items: center; flex-wrap: wrap; }
.owl-history-list { display: flex; flex-direction: column; gap: 10px; max-height: 440px; overflow-y: auto; }
.owl-history-item { width: 100%; text-align: left; border: 1px solid #e2e8f0; background: #f8fafc; color: #0f172a; padding: 12px 14px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; box-shadow: 0 6px 20px rgba(15,23,42,0.06); }
.owl-history-item:hover { background: #eef2ff; }
.owl-history-meta { font-size: 0.9rem; color: #475569; }
.owl-history-label { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.owl-history-actions { display: flex; align-items: center; gap: 6px; }
.owl-history-modal { background: #ffffff; }
.owl-history-empty { color: #94a3b8; text-align: center; padding: 20px 0; }
.owl-chat-body { background: #e7ecf5; border: 1px solid #d3dce7; border-radius: 20px; padding: 1rem; min-height: 340px; max-height: 62vh; overflow-y: auto; scroll-behavior: smooth; }
.owl-chat-messages { display: flex; flex-direction: column; gap: 0.7rem; width: 100%; }
.owl-chat-row { display: flex; align-items: flex-end; gap: 0.65rem; width: 100%; }
.owl-chat-row.user { justify-content: flex-end; }
.owl-chat-row.meta { justify-content: center; }
.owl-chat-row.meta .owl-chat-bubble { max-width: 90%; background: #f1f5f9; color: #0f172a; border: 1px solid #e2e8f0; text-align: center; }
.owl-chat-avatar { width: 42px; height: 42px; border-radius: 12px; border: 1px solid #e2e8f0; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 26px rgba(15,23,42,0.08); flex-shrink: 0; }
.owl-chat-avatar img { width: 30px; height: 30px; object-fit: contain; }
.owl-chat-bubble { padding: 0.8rem 1rem; border-radius: 18px; max-width: min(76%, 760px); box-shadow: 0 10px 24px rgba(15,23,42,0.08); line-height: 1.5; }
.owl-chat-bubble.owl { background: #ffffff; color: #0f172a; border: 1px solid #e2e8f0; border-bottom-left-radius: 10px; }
.owl-chat-bubble.user { background: linear-gradient(135deg, #6A11CB, #2575FC); color: #fff; border-bottom-right-radius: 10px; }
.owl-chat-processing { display: inline-flex; align-items: center; gap: 0.55rem; color: #0f172a; }
.owl-chat-typing { display: inline-flex; gap: 0.3rem; }
.owl-chat-typing span { width: 8px; height: 8px; background: #6A11CB; border-radius: 50%; display: inline-block; animation: owlTyping 1.4s infinite; }
.owl-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.owl-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes owlTyping { 0% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-4px); opacity: 1; } 100% { transform: translateY(0); opacity: 0.4; } }
.owl-chat-upload-card { background: linear-gradient(135deg, #f8fafc, #eef2ff); border: 1px dashed #cbd5e1; border-radius: 16px; padding: 1rem; color: #0f172a; box-shadow: inset 0 1px 0 rgba(255,255,255,0.9); }
.owl-chat-upload-card p { margin: 0 0 0.35rem 0; color: #334155; }
.owl-chat-input { display: flex; flex-direction: column; gap: 0.5rem; }
.owl-chat-input-row .form-control-lg { border-radius: 14px 0 0 14px; }
.owl-chat-input-row .btn { border-radius: 0 14px 14px 0; display: inline-flex; align-items: center; justify-content: center; }
.owl-chat-quota { color: #475569; font-size: 0.95rem; }
.owl-chat-hint { color: #64748b; font-size: 0.9rem; }
.owl-chat-empty { text-align: center; color: #94a3b8; padding: 1.5rem 0; }
.owl-chat-input-row .form-control:disabled { background: #e2e8f0; cursor: not-allowed; }
.owl-chat-upload-card .btn:hover { transform: translateY(-1px); }


/* --- Question / Réponse --- */
.qa-card {
    background-color: #ffffff;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    padding: clamp(1.4rem, 2vw, 2rem);
    color: #0f172a;
    text-align: left;
    box-shadow: 0 18px 45px rgba(15,23,42,0.12);
}
.qa-question-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
}
.qa-question-text {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}
.qa-answer {
    background-color: #f1f5f9;
    border-radius: 16px;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    display: none;
    margin-top: 1rem;
}
.qa-answer.visible {
    display: block;
}
.qa-answer-label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

/* --- Chronologie --- */
.chronology-card {
    background-color: #ffffff;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    text-align: left;
    box-shadow: 0 18px 45px rgba(15,23,42,0.12);
}
.chronology-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}
.chronology-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.95);
    color: #1f1f1f;
    border-radius: 16px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chronology-item:last-child {
    margin-bottom: 0;
}
.chronology-item.chronology-correct {
    border: 2px solid rgba(40, 199, 111, 0.9);
    background-color: #ffffff;
}
.chronology-item.chronology-incorrect {
    border: 2px solid rgba(255, 107, 107, 0.9);
    background-color: #ffffff;
}
.chronology-grip {
    color: #6c757d;
    font-size: 1.5rem;
    cursor: grab;
    display: flex;
}
.chronology-ghost {
    opacity: 0.5;
}
.chronology-label {
    font-weight: 600;
    margin-bottom: 0.2rem;
}
.chronology-details {
    margin-bottom: 0;
    color: #4f4f4f;
}
.chronology-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.chronology-feedback {
    min-height: 24px;
}

/* --- Podcast --- */
.podcast-audio-bar {
    background: #ffffff;
    color: #0f172a;
    border-radius: 22px;
    padding: 1rem 1.25rem;
    box-shadow: 0 18px 45px rgba(15,23,42,0.08);
    border: 1px solid #e2e8f0;
}
.podcast-audio-top {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.podcast-play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #6A11CB, #2575FC);
    color: white;
    box-shadow: 0 10px 22px rgba(15,23,42,0.15);
}
.podcast-play-btn:disabled {
    background: #e2e8f0;
    color: #6c757d;
    cursor: not-allowed;
}
.podcast-audio-info {
    flex: 1;
    min-width: 200px;
}
.podcast-audio-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
}
.podcast-audio-status {
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
}
.podcast-progress {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.5rem;
}
.podcast-progress input[type="range"] {
    width: 100%;
    accent-color: #6A11CB;
}
.podcast-progress span {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    min-width: 46px;
    text-align: center;
}
.podcast-card {
    background-color: #ffffff;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    padding: clamp(1.5rem, 2vw, 2.25rem);
    text-align: left;
    box-shadow: 0 18px 45px rgba(15,23,42,0.12);
}
.podcast-segment {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.podcast-segment h5 {
    margin-bottom: 0.5rem;
    color: #6A11CB;
}
.podcast-segment:last-child {
    margin-bottom: 0;
}

/* --- Tutor explanation chips --- */
.tutor-explanation {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    text-align: left;
}
.tutor-explanation h6 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    color: #64748b;
}

/* --- Modals list view --- */
.modal-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.modal-list-item {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.modal-list-item-title {
    font-weight: 600;
    margin: 0;
}
.modal-list-item small {
    color: rgba(0, 0, 0, 0.55);
}
.modal-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(0, 0, 0, 0.5);
}

/* --- Auth modal --- */
.auth-modal {
    background: linear-gradient(135deg, #ffffff, #f3f4ff);
    border: none;
    border-radius: 20px;
}
.auth-modal .modal-header { border-bottom: none; padding-bottom: 0; }
.auth-modal .modal-body { padding-top: 0; }
.auth-modal .nav-pills .nav-link {
    color: #6A11CB;
    font-weight: 600;
    border-radius: 12px;
}
.auth-modal .nav-pills .nav-link.active {
    background: linear-gradient(135deg, #6A11CB, #2575FC);
    color: white;
}
.auth-step-header { margin-bottom: 1rem; }
.auth-step-title { font-weight: 600; margin-bottom: 0.25rem; }
.auth-step-subtitle {
    color: rgba(0, 0, 0, 0.55);
    font-size: 0.95rem;
    margin-bottom: 0;
}
.auth-link {
    color: #ff7a00;
    font-weight: 600;
    text-decoration: none;
}
.auth-link:hover {
    color: #ff9a32;
    text-decoration: underline;
}
.password-conditions {
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}
.password-conditions-title {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.6);
}
.password-condition {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    color: #dc3545;
}
.password-condition .condition-icon { font-size: 1rem; }
.password-condition.is-valid { color: #198754; }
.auth-success {
    color: #198754;
    min-height: 22px;
    font-size: 0.95rem;
}
.auth-form .form-control {
    border-radius: 12px;
    padding: 0.85rem 1rem;
}
.auth-error {
    color: #dc3545;
    min-height: 22px;
    font-size: 0.95rem;
}

/* --- Instruction modal tweaks --- */
#instructionModal .modal-content {
    background: linear-gradient(150deg, #0f1526, #1a2540);
    color: white;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 50px rgba(0,0,0,0.35);
}
#instructionModal .modal-header,
#instructionModal .modal-footer {
    border-color: rgba(255, 255, 255, 0.08);
}
#instructionModal .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
#instructionModal textarea {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 14px;
}
#instructionModal textarea::placeholder { color: rgba(255, 255, 255, 0.65); }
#instructionModal textarea:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #9ab0ff;
    box-shadow: 0 0 0 0.2rem rgba(106, 17, 203, 0.35);
}
#instructionModal .instruction-suggestions { margin-top: 0.75rem; }
#instructionModal .instruction-suggestion {
    background: linear-gradient(135deg, rgba(147, 165, 255, 0.25), rgba(106, 17, 203, 0.25));
    border: 1px solid rgba(255, 255, 255, 0.22);
}
#instructionModal .instruction-suggestion:hover {
    background: linear-gradient(135deg, rgba(147, 165, 255, 0.35), rgba(106, 17, 203, 0.32));
}

/* --- Side menu info card --- */
.menu-info-card {
    background: linear-gradient(135deg, rgba(106,17,203,0.9), rgba(37,117,252,0.85));
    border-radius: 16px;
    padding: 1.1rem;
    color: white;
    text-align: left;
    line-height: 1.5;
}
.menu-info-card .menu-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
}
.menu-info-card .menu-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}
.menu-info-card .menu-actions .btn {
    flex: 1;
    min-width: 120px;
}
.menu-info-card--stacked {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.menu-questions-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    flex-wrap: nowrap;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
}
.menu-questions-row small {
    white-space: nowrap;
}
.menu-questions-action {
    width: 100%;
}
.menu-questions-action .btn {
    width: 100%;
    white-space: nowrap;
}
.menu-questions-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
}
.menu-questions-row .btn {
    white-space: nowrap;
}
.menu-bonus-card {
    background: var(--card-bg, #f8f9fb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.menu-bonus-card.ready {
    border-color: #4ade80;
    box-shadow: 0 12px 28px rgba(74, 222, 128, 0.18);
}
.dark-mode .menu-bonus-card {
    background: var(--card-bg);
    border-color: var(--border-color);
    box-shadow: 0 12px 28px var(--shadow-strong, rgba(0,0,0,0.35));
}
.menu-bonus-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(106,17,203,0.12), rgba(37,117,252,0.12));
    color: #2575fc;
    font-size: 1rem;
}
.menu-bonus-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e4db7;
    font-weight: 600;
    font-size: 0.9rem;
}
.dark-mode .menu-bonus-icon {
    background: rgba(255, 255, 255, 0.08);
    color: #dbeafe;
}
.dark-mode .menu-bonus-pill {
    background: rgba(255, 255, 255, 0.08);
    color: #e5edff;
}
.menu-bonus-note {
    font-size: 0.85rem;
}
.menu-settings-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    box-shadow: 0 12px 28px rgba(15,23,42,0.12);
}
.menu-settings-card small { color: var(--text-muted); }
.menu-settings-card .form-check-input { cursor: pointer; }

.settings-modal { background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border-color); }
.settings-modal .modal-header, .settings-modal .modal-footer { border-color: var(--border-color); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border-color); }
.settings-row:last-child { border-bottom: none; }
.settings-row__title { font-weight: 700; color: var(--text-primary); }
.settings-row__subtitle { color: var(--text-muted); font-size: 0.92rem; }
.settings-row--danger .settings-row__title { color: #dc3545; }
.settings-row--danger .settings-row__subtitle { color: var(--text-muted); }
.settings-lang-dropdown .dropdown-toggle { display: flex; align-items: center; justify-content: space-between; }
.settings-lang-dropdown .dropdown-menu { max-height: 260px; overflow-y: auto; }

/* --- Mode sombre (overrides) --- */
body.dark-mode .quiz-card,
body.dark-mode .summary-card,
body.dark-mode .vocab-card,
body.dark-mode .qa-card,
body.dark-mode .chronology-card,
body.dark-mode .podcast-card,
body.dark-mode .advanced-options-card,
body.dark-mode .instruction-panel {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--stroke-strong);
    box-shadow: 0 22px 48px var(--shadow-strong);
}
body.dark-mode .modal-content,
body.dark-mode .offcanvas,
body.dark-mode .dropdown-menu {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}
body.dark-mode .list-group-item {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode textarea {
    background-color: var(--soft-surface);
    color: var(--text-primary);
    border-color: var(--stroke-strong);
}
body.dark-mode .surface-panel .btn-outline-light {
    color: var(--text-primary);
    border-color: var(--chip-border);
}
body.dark-mode .surface-panel .btn-outline-light:hover {
    background: var(--chip-bg);
    color: var(--text-primary);
    border-color: var(--chip-border);
}
body.dark-mode .form-control::placeholder,
body.dark-mode textarea::placeholder { color: var(--text-muted); }
body.dark-mode .custom-type-card .custom-type-icon { background: rgba(255,255,255,0.08); }
body.dark-mode .custom-library-empty,
body.dark-mode .custom-empty-state .custom-empty-card { color: var(--text-secondary); }
body.dark-mode .tutor-dialog {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}
body.dark-mode .tutor-dialog p { color: var(--text-secondary); }
body.dark-mode .tutor-dialog h6 { color: var(--text-primary); }

body.dark-mode .save-modal-body { background: linear-gradient(135deg, var(--surface-bg) 0%, var(--soft-surface) 100%); }
body.dark-mode .save-modal-section {
    background: var(--card-bg);
    border-color: var(--border-color);
    box-shadow: 0 14px 28px var(--shadow-strong);
}
body.dark-mode .save-modal-eyebrow { color: var(--text-eyebrow); }
body.dark-mode .save-modal-title { color: var(--text-primary); }
body.dark-mode .save-modal-help { color: var(--text-secondary); }
body.dark-mode .save-modal-badge { background: var(--chip-bg); border: 1px solid var(--chip-border); color: var(--text-primary); }
body.dark-mode .save-folder-card {
    background: var(--soft-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}
body.dark-mode .save-folder-card:hover {
    border-color: var(--chip-border);
    box-shadow: 0 10px 22px var(--shadow-strong);
}
body.dark-mode .save-folder-card.active {
    background: var(--chip-bg);
    border-color: var(--chip-border);
    box-shadow: 0 12px 26px var(--shadow-strong);
}
body.dark-mode .save-folder-icon { background: var(--card-bg); }
body.dark-mode .save-folder-count { color: var(--text-secondary); }
body.dark-mode .save-modal-section label { color: var(--text-muted); }
body.dark-mode .save-inline-folder .input-group-text {
    background: var(--soft-surface);
    border-color: var(--border-color);
    color: var(--text-secondary);
}
body.dark-mode .save-inline-folder .btn-light {
    background: var(--button-light-bg);
    border-color: var(--button-light-border);
    color: var(--button-light-text);
}

body.dark-mode .saved-screen,
body.dark-mode .history-screen {
    background: var(--surface-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: 0 22px 46px rgba(0,0,0,0.35);
}
body.dark-mode .saved-eyebrow { color: var(--text-eyebrow); }
body.dark-mode .saved-title,
body.dark-mode .saved-folder-title,
body.dark-mode .saved-grid-title,
body.dark-mode .saved-quiz-title { color: var(--text-primary); }
body.dark-mode .saved-subtitle,
body.dark-mode .saved-quiz-meta,
body.dark-mode .saved-grid-meta,
body.dark-mode .saved-note { color: var(--text-secondary); }
body.dark-mode .saved-back-btn,
body.dark-mode .saved-toggle,
body.dark-mode .saved-sort-btn,
body.dark-mode .saved-folder-actions .btn,
body.dark-mode .saved-type-actions .btn,
body.dark-mode .saved-folder-badge,
body.dark-mode .saved-folder-toggle,
body.dark-mode .saved-type-toggle,
body.dark-mode .saved-quiz-actions .btn {
    background: var(--surface-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}
body.dark-mode .saved-toggle-btn { color: var(--text-primary); }
body.dark-mode .saved-toggle-btn.active { background: var(--chip-bg); color: var(--text-primary); }
body.dark-mode .saved-folder-card,
body.dark-mode .saved-type-block,
body.dark-mode .saved-quiz-card,
body.dark-mode .saved-grid-card,
body.dark-mode .saved-stat-card,
body.dark-mode .saved-empty-card {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}
body.dark-mode .saved-empty-card p { color: var(--text-secondary); }
body.dark-mode .saved-folder-icon,
body.dark-mode .saved-empty-icon,
body.dark-mode .saved-stat-card .icon { background: var(--chip-bg); }
body.dark-mode .saved-type-chip,
body.dark-mode .saved-folder-badge {
    background: var(--chip-bg);
    border-color: var(--chip-border);
    color: var(--text-primary);
}
body.dark-mode .saved-type-count { color: var(--text-secondary); }
body.dark-mode .history-chip { background: var(--chip-bg); border-color: var(--chip-border); color: var(--text-primary); }
body.dark-mode .history-chip--muted { background: var(--surface-bg); color: var(--text-secondary); }
body.dark-mode .history-card .history-icon { background: var(--chip-bg); color: var(--text-primary); box-shadow: 0 10px 22px rgba(0,0,0,0.25); }
body.dark-mode .history-card .history-title { color: var(--text-primary); }
body.dark-mode .history-card .history-preview { color: var(--text-secondary); }
body.dark-mode .history-date { color: var(--text-muted); }
body.dark-mode .support-shell,
body.dark-mode .owl-chat-shell { background: var(--surface-bg); color: var(--text-primary); box-shadow: 0 24px 52px var(--shadow-strong); }
body.dark-mode .support-body,
body.dark-mode .owl-chat-body { background: var(--surface-bg); border-color: var(--border-color); }
body.dark-mode .support-bubble { background: var(--card-bg); color: var(--text-primary); border-color: var(--border-color); }
body.dark-mode .support-eyebrow,
body.dark-mode .support-hint,
body.dark-mode .support-subtitle,
body.dark-mode .support-empty,
body.dark-mode .support-meta { color: var(--text-muted); }
body.dark-mode .owl-chat-eyebrow { color: var(--text-eyebrow); }
body.dark-mode .owl-chat-subtitle { color: var(--text-secondary); }
body.dark-mode .owl-chat-row.meta .owl-chat-bubble { background: var(--card-bg); color: var(--text-primary); border-color: var(--border-color); }
body.dark-mode .owl-history-modal { background: var(--surface-bg); color: var(--text-primary); }
body.dark-mode .owl-history-item { background: var(--soft-surface); border-color: var(--border-color); color: var(--text-primary); }
body.dark-mode .owl-history-meta { color: var(--text-secondary); }
body.dark-mode .quiz-card-title { color: var(--text-primary); }
body.dark-mode .quiz-view-toggle { background: var(--chip-bg); border-color: var(--stroke-strong); }
body.dark-mode .quiz-view-toggle button { color: var(--text-primary); }
body.dark-mode .quiz-view-toggle button.active { background: var(--soft-surface); color: var(--text-primary); }
body.dark-mode .option-item {
    background: var(--soft-surface);
    border-color: var(--stroke-strong);
    color: var(--text-primary);
    box-shadow: 0 14px 30px var(--shadow-strong);
}
body.dark-mode .option-item.correct { background-color: rgba(40,199,111,0.14); border-color: #2fb371; color: #c6f7da; }
body.dark-mode .option-item.incorrect { background-color: rgba(255,107,107,0.14); border-color: #ff6b6b; color: #ffd1d1; }
body.dark-mode .option-item.selected { background-color: rgba(37,117,252,0.16); border-color: #4f8bff; color: #d9e4ff; }
body.dark-mode .flashcard-face,
body.dark-mode .flashcard-back {
    background-color: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 14px 30px var(--shadow-strong);
    border: 1px solid var(--stroke-strong);
}
body.dark-mode .flashcard-back { background-color: var(--soft-surface); }
body.dark-mode .flashcard-nav .btn {
    background: var(--chip-bg);
    color: var(--text-primary);
    border-color: var(--stroke-strong);
}
body.dark-mode .fill-blank-input {
    background: var(--soft-surface);
    border-color: var(--stroke-strong);
    color: var(--text-primary);
}
body.dark-mode .qa-answer {
    background: var(--soft-surface);
    border-color: var(--stroke-strong);
    color: var(--text-primary);
}
body.dark-mode .chronology-item {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--stroke-strong);
    box-shadow: 0 12px 28px var(--shadow-strong);
}
body.dark-mode .chronology-item.chronology-correct { border-color: #2fb371; background: rgba(40,199,111,0.14); }
body.dark-mode .chronology-item.chronology-incorrect { border-color: #ff6b6b; background: rgba(255,107,107,0.14); }
body.dark-mode .podcast-audio-bar { background: var(--card-bg); border-color: var(--stroke-strong); color: var(--text-primary); box-shadow: 0 18px 42px var(--shadow-strong); }
body.dark-mode .podcast-progress span { color: var(--text-primary); }
body.dark-mode .podcast-progress input[type="range"] { accent-color: #8c78ff; }
body.dark-mode .podcast-segment { background: var(--soft-surface); border-color: var(--stroke-strong); }
body.dark-mode .vocab-card {
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 18px 42px var(--shadow-strong);
    border-color: var(--stroke-strong);
}
body.dark-mode .vocab-word-to-translate { color: #a5b4ff; }

.results-menu .dropdown-menu { min-width: 220px; }

/* --- Dark mode: quiz surfaces & cards --- */
body.dark-mode .quiz-card,
body.dark-mode .summary-card,
body.dark-mode .vocab-card,
body.dark-mode .qa-card,
body.dark-mode .chronology-card,
body.dark-mode .podcast-audio-bar,
body.dark-mode .podcast-card,
body.dark-mode .instruction-panel,
body.dark-mode .advanced-options-card {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: 0 18px 44px var(--shadow-strong);
}
body.dark-mode .quiz-card-title,
body.dark-mode .summary-card-title,
body.dark-mode .vocab-word-to-translate,
body.dark-mode .tutor-card h5,
body.dark-mode .advanced-title { color: var(--text-primary); }
body.dark-mode .summary-card p,
body.dark-mode .quiz-score-copy,
body.dark-mode .advanced-subtitle,
body.dark-mode .chronology-details,
body.dark-mode .tutor-card p { color: var(--text-secondary); }
body.dark-mode .option-item,
body.dark-mode .fill-blank-input,
body.dark-mode .qa-answer,
body.dark-mode .chronology-item,
body.dark-mode .podcast-segment,
body.dark-mode .custom-option-row,
body.dark-mode .results-card-shell,
body.dark-mode .results-toolbar .btn {
    background: var(--soft-surface);
    color: var(--text-primary);
    border-color: var(--stroke-strong);
}
body.dark-mode .action-btn {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--stroke-strong);
    box-shadow: 0 16px 40px var(--shadow-strong);
}
body.dark-mode .action-btn:hover {
    background: var(--soft-surface);
    color: var(--text-primary);
    box-shadow: 0 12px 30px var(--shadow-strong);
}
body.dark-mode .action-btn i {
    background: linear-gradient(135deg, #a5b4ff, #7c90ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}
body.dark-mode .instruction-panel-title { color: var(--text-primary); }
body.dark-mode .instruction-panel-subtitle,
body.dark-mode .instruction-empty,
body.dark-mode .instruction-panel__note { color: var(--text-secondary); }
body.dark-mode .instruction-panel__note,
body.dark-mode .instruction-chip,
body.dark-mode .instruction-chip-remove,
body.dark-mode .instruction-clear-link,
body.dark-mode .instruction-suggestion {
    background: var(--soft-surface);
    border-color: var(--stroke-strong);
    color: var(--text-primary);
    box-shadow: none;
}
body.dark-mode .instruction-chip-remove,
body.dark-mode .instruction-clear-link { box-shadow: 0 10px 20px var(--shadow-strong); }
body.dark-mode .tutor-card {
    background: var(--card-bg);
    border-color: var(--stroke-strong);
    box-shadow: 0 22px 48px var(--shadow-strong);
}
body.dark-mode .tutor-card::before {
    background: radial-gradient(circle at 50% 40%, rgba(80, 227, 194, 0.18), transparent 55%);
}
body.dark-mode .option-item:hover:not(.answered) { box-shadow: 0 14px 28px var(--shadow-strong); }
body.dark-mode .quiz-view-toggle,
body.dark-mode .quiz-view-toggle button.active { background: var(--chip-bg); border-color: var(--chip-border); color: var(--text-primary); }
body.dark-mode .flashcard-face { background: var(--card-bg); color: var(--text-primary); box-shadow: 0 14px 30px var(--shadow-strong); }
body.dark-mode .flashcard-back { background: var(--soft-surface); }
body.dark-mode .flashcard-nav .btn { background: var(--chip-bg); color: var(--text-primary); border-color: var(--chip-border); box-shadow: 0 12px 24px var(--shadow-strong); }
body.dark-mode .flashcard-swipe-hint { color: var(--text-muted); }
body.dark-mode .custom-type-card .custom-type-icon,
body.dark-mode .tutor-icon-bubble { background: linear-gradient(135deg, #1f2d44, #1b2940); }
body.dark-mode .owl-chat-bubble.owl,
body.dark-mode .owl-chat-row.meta .owl-chat-bubble {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--stroke-strong);
    box-shadow: 0 18px 40px var(--shadow-strong);
}
body.dark-mode .owl-chat-bubble.user {
    box-shadow: 0 18px 40px var(--shadow-strong);
}
body.dark-mode .owl-chat-upload-card,
body.dark-mode .owl-chat-body {
    background: var(--soft-surface);
    border-color: var(--stroke-strong);
    color: var(--text-primary);
}
body.dark-mode .owl-chat-avatar { background: var(--card-bg); border-color: var(--stroke-strong); }
body.dark-mode .owl-chat-processing,
body.dark-mode .owl-chat-hint,
body.dark-mode .owl-chat-subtitle { color: var(--text-secondary); }
body.dark-mode .owl-chat-input-row .form-control:disabled { background: var(--soft-surface); color: var(--text-muted); }

/* --- Paywall Premium --- */
.premium-modal .modal-dialog { max-width: 920px; }
.premium-modal-content {
    background: radial-gradient(circle at 20% 15%, rgba(99,102,241,0.12), transparent 35%), radial-gradient(circle at 80% 10%, rgba(14,165,233,0.12), transparent 35%), linear-gradient(180deg, #ffffff, #f7f9ff);
    color: #0f172a;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 30px 80px rgba(15,23,42,0.18);
    position: relative;
    overflow: hidden;
}
.premium-modal-content::before,
.premium-modal-content::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.14), transparent 60%);
    filter: blur(10px);
    opacity: 0.6;
}
.premium-modal-content::before { top: -80px; right: -40px; }
.premium-modal-content::after { bottom: -100px; left: -60px; }
.premium-close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.premium-offer-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.2rem 2.4rem 0;
    padding: 0.9rem 1rem;
    background: linear-gradient(120deg, #eef2ff, #e0f2fe);
    border: 1px solid #dbeafe;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(99,102,241,0.12);
}
.premium-offer-left { display: flex; flex-direction: column; gap: 0.2rem; }
.premium-offer-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    color: #312e81;
    background: #c7d2fe;
    box-shadow: inset 0 0 0 1px #a5b4fc;
}
.premium-offer-copy { color: #0f172a; font-weight: 800; font-size: 1rem; }
.premium-offer-timer {
    font-weight: 700;
    color: #0ea5e9;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.9rem;
}
.premium-hero { padding: 2.1rem 2.4rem 1.2rem; position: relative; z-index: 1; }
.premium-hero-top { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.premium-pill, .premium-mini-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.02em;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
}
.premium-pill { background: linear-gradient(120deg, #bbf7d0, #a5b4fc); border-color: #a5b4fc; color: #0f172a; }
.premium-mini-pill { font-size: 0.9rem; color: #0f172a; }
.premium-title { font-weight: 900; font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0.6rem 0 0.35rem; color: #0f172a; }
.premium-subtitle { margin: 0; color: #475569; font-size: 1.05rem; }
.premium-login-hint { color: #64748b; margin-top: 0.3rem; }
.premium-body { padding: 0 2.4rem 2rem; position: relative; z-index: 1; }
.premium-section-title { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; color: #475569; margin-bottom: 0.65rem; }
.premium-feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.9rem; margin-bottom: 1.4rem; }
.premium-feature-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.95rem;
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    box-shadow: 0 16px 40px rgba(15,23,42,0.12);
}
.premium-feature-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #a5b4fc, #67e8f9);
    color: #0f172a;
    font-size: 1.25rem;
}
.premium-feature-text { color: #0f172a; font-weight: 800; margin: 0; }
.premium-feature-sub { color: #475569; margin: 0.1rem 0 0; }
.premium-plan-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.95rem;
    margin-bottom: 1rem;
    box-shadow: 0 14px 36px rgba(15,23,42,0.12);
}
.premium-plan-toggle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.75rem;
}
.premium-plan-btn {
    width: 100%;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #0f172a;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.premium-plan-btn .premium-plan-label { font-weight: 800; letter-spacing: 0.01em; }
.premium-plan-price { color: #0f172a; font-size: 1.08rem; font-weight: 800; }
.premium-plan-btn.active,
.premium-plan-btn:hover {
    border-color: #6366f1;
    box-shadow: 0 16px 40px rgba(99,102,241,0.2);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #eef2ff, #e0f2fe);
}
.premium-plan-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.premium-plan-labels { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.premium-plan-price-row { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.premium-plan-old { color: #94a3b8; text-decoration: line-through; font-weight: 700; font-size: 0.95rem; }
.premium-plan-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.9rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
}
.premium-plan-chip.discount { background: #fee2e2; border-color: #fecdd3; color: #b91c1c; }
.premium-plan-chip.best { background: #d9f99d; border-color: #bef264; color: #3f6212; }
.premium-plan-note {
    margin: 0.65rem 0 0;
    color: #475569;
    font-size: 0.95rem;
}
.premium-actions .btn { border-radius: 14px; }
.btn-premium-primary {
    background: linear-gradient(120deg, #22c55e, #6366f1, #06b6d4);
    border: none;
    font-weight: 800;
    box-shadow: 0 20px 44px rgba(99,102,241,0.28);
    color: #fff;
}
.btn-premium-primary.loading {
    opacity: 0.8;
    pointer-events: none;
}
.btn-premium-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-premium-primary:active { transform: translateY(0); }
.premium-modal-content .btn-outline-light {
    border-width: 1.5px;
    font-weight: 700;
    color: #0f172a;
    border-color: #e2e8f0;
    background: #ffffff;
}
.premium-modal-content .btn-outline-light:hover { background: #f8fafc; }
.premium-cta-label { display: block; }
.premium-cta-sub { display: block; font-size: 0.95rem; color: rgba(255,255,255,0.92); font-weight: 600; }

/* Paywall dark mode */
body.dark-mode .premium-modal-content {
    background: radial-gradient(circle at 20% 20%, rgba(99,102,241,0.25), transparent 32%), radial-gradient(circle at 80% 0%, rgba(14,165,233,0.22), transparent 28%), linear-gradient(160deg, #0b1021, #0f172a 55%, #0b1226);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 28px 80px rgba(0,0,0,0.45);
}
body.dark-mode .premium-modal-content::before,
body.dark-mode .premium-modal-content::after {
    background: radial-gradient(circle, rgba(99,102,241,0.22), transparent 55%);
    filter: blur(6px);
    opacity: 0.6;
}
body.dark-mode .premium-offer-banner {
    background: linear-gradient(120deg, rgba(255,255,255,0.08), rgba(99,102,241,0.12));
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}
body.dark-mode .premium-offer-pill {
    background: rgba(255,255,255,0.12);
    color: #fff;
    box-shadow: none;
    border: 1px solid rgba(255,255,255,0.18);
}
body.dark-mode .premium-offer-copy { color: rgba(255,255,255,0.92); }
body.dark-mode .premium-offer-timer { color: #a5f3fc; }
body.dark-mode .premium-pill,
body.dark-mode .premium-mini-pill {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.16);
    color: #fff;
}
body.dark-mode .premium-title { color: #fff; }
body.dark-mode .premium-subtitle { color: rgba(255,255,255,0.78); }
body.dark-mode .premium-login-hint { color: rgba(255,255,255,0.7); }
body.dark-mode .premium-section-title { color: rgba(255,255,255,0.7); }
body.dark-mode .premium-feature-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 16px 40px rgba(0,0,0,0.25);
}
body.dark-mode .premium-feature-icon { color: #fff; background: linear-gradient(135deg, rgba(99,102,241,0.28), rgba(59,130,246,0.25)); }
body.dark-mode .premium-feature-text { color: rgba(255,255,255,0.9); }
body.dark-mode .premium-feature-sub { color: rgba(255,255,255,0.72); }
body.dark-mode .premium-plan-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 14px 36px rgba(0,0,0,0.25);
}
body.dark-mode .premium-plan-btn {
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: #fff;
}
body.dark-mode .premium-plan-btn .premium-plan-price { color: rgba(255,255,255,0.78); }
body.dark-mode .premium-plan-btn.active,
body.dark-mode .premium-plan-btn:hover {
    border-color: #c4d3ff;
    box-shadow: 0 16px 40px rgba(99,102,241,0.26);
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(34,211,238,0.18));
}
body.dark-mode .premium-plan-old { color: rgba(255,255,255,0.55); }
body.dark-mode .premium-plan-chip {
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.08);
    color: #fff;
}
body.dark-mode .premium-plan-chip.discount { background: rgba(248,113,113,0.16); border-color: rgba(252,165,165,0.25); color: #fecdd3; }
body.dark-mode .premium-plan-chip.best { background: rgba(132,204,22,0.18); border-color: rgba(190,242,100,0.4); color: #dcfce7; }
body.dark-mode .premium-plan-note {
    margin: 0.65rem 0 0;
    color: rgba(255,255,255,0.76);
    font-size: 0.95rem;
}
body.dark-mode .premium-modal-content .btn-outline-light {
    border-width: 1.5px;
    font-weight: 700;
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.3);
    background: transparent;
}
body.dark-mode .premium-cta-sub { color: rgba(255,255,255,0.82); }
/* --- Pop-up succès achat --- */
.purchase-success-pop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(circle at 20% 20%, rgba(99,102,241,0.2), transparent 40%), radial-gradient(circle at 80% 10%, rgba(34,211,238,0.16), transparent 40%), rgba(4,7,15,0.75);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    z-index: 20000;
}
.purchase-success-pop.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}
.purchase-success-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(99,102,241,0.3), transparent 45%), radial-gradient(circle at 75% 30%, rgba(34,211,238,0.25), transparent 45%);
    filter: blur(18px);
    opacity: 0.7;
    animation: successGlow 12s ease-in-out infinite alternate;
}
.purchase-success-card {
    position: relative;
    max-width: 620px;
    width: 100%;
    background: linear-gradient(160deg, rgba(10,16,35,0.9), rgba(14,22,46,0.95));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 28px 80px rgba(0,0,0,0.5);
    border-radius: 20px;
    padding: 1.4rem 1.6rem;
    display: flex;
    gap: 1.1rem;
    align-items: center;
    overflow: hidden;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
.purchase-success-pop.is-visible .purchase-success-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.purchase-success-card::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    right: -60px;
    top: -60px;
    background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 60%);
    filter: blur(6px);
}
.purchase-success-icon {
    width: 66px;
    height: 66px;
    min-width: 66px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #22d3ee, #6366f1);
    color: #fff;
    font-size: 1.9rem;
    box-shadow: 0 20px 44px rgba(99,102,241,0.42);
    animation: successIconPulse 2.8s ease-in-out infinite;
}
.purchase-success-content { position: relative; z-index: 1; }
.purchase-success-eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #cbd5e1;
    font-weight: 800;
    font-size: 0.78rem;
}
.purchase-success-title {
    margin: 0.05rem 0 0.3rem;
    color: #fff;
    font-weight: 900;
    letter-spacing: 0.01em;
}
.purchase-success-subtitle {
    margin: 0;
    color: rgba(255,255,255,0.78);
    font-size: 0.98rem;
}
.purchase-success-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.9rem;
}
.purchase-success-card .btn {
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(0,0,0,0.25);
}
.purchase-success-card .btn-primary {
    background: linear-gradient(120deg, #22d3ee, #6366f1);
    border: none;
    font-weight: 800;
}
.purchase-success-card .btn-light {
    background: rgba(255,255,255,0.92);
    border: none;
    font-weight: 700;
    color: #0f172a;
}
@keyframes successIconPulse {
    0% { transform: scale(0.97); }
    50% { transform: scale(1.05); }
    100% { transform: scale(0.97); }
}
@keyframes successGlow {
    0% { opacity: 0.65; transform: translateY(0); }
    50% { opacity: 0.88; transform: translateY(-6px); }
    100% { opacity: 0.65; transform: translateY(0); }
}
@media (max-width: 576px) {
    .purchase-success-card {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    .purchase-success-actions { justify-content: center; }
}
@media (max-width: 768px) {
    .premium-modal-content { border-radius: 18px; }
    .premium-hero, .premium-body { padding: 1.5rem 1.25rem; }
    .premium-feature-card { flex-direction: row; }
    .premium-offer-banner { flex-direction: column; align-items: flex-start; margin: 1rem 1.25rem 0; }
}

@media (max-width: 768px) {
    .owl-cta-card { padding: 1rem; }
    .owl-cta-visual { width: 100%; justify-content: flex-start; }
    .owl-chat-body { max-height: none; }
}

/* Auth modal: adapt to dark mode */
body.dark-mode #authModal .modal-content {
    background: #0f1115;
    color: #f3f4f6;
    border-color: #1c1f26;
}
body.dark-mode #authModal .modal-header,
body.dark-mode #authModal .modal-footer {
    border-color: #1c1f26;
}
body.dark-mode #authModal .form-control {
    background: #161922;
    color: #f3f4f6;
    border-color: #262a34;
}
body.dark-mode #authModal .form-control:focus {
    background: #161922;
    color: #f3f4f6;
    border-color: #3a4254;
    box-shadow: 0 0 0 0.2rem rgba(122, 162, 247, 0.2);
}
body.dark-mode #authModal .form-control::placeholder {
    color: #9aa0ad;
}
body.dark-mode #authModal .modal-title,
body.dark-mode #authModal label,
body.dark-mode #authModal .nav-link {
    color: #f3f4f6;
}
body.dark-mode #authModal .nav-link.active {
    color: #ffffff;
}
body.dark-mode #authModal .auth-step-subtitle,
body.dark-mode #authModal .password-conditions-title {
    color: #9aa0ad;
}
body.dark-mode #authModal .auth-link {
    color: #ff9a32;
}

/* Hero title should stay white even in light mode for contrast */
#hero-title {
    color: #ffffff;
}
