﻿/* =============================================
   GLOBAL RESET & BASE
   ============================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1e90ff;
    --primary-dark: #0a3d62;
    --primary-light: #00bfff;
    --accent: #ff9800;
    --success: #4caf50;
    --danger: #f44336;
    --bg-card: #f0f8ff;
    --bg-card2: #e0f4ff;
    --radius: 14px;
    --shadow: 0 8px 32px rgba(30,144,255,0.18);
    --transition: 0.25s ease;

    --fs-xs: clamp(0.7rem, 1.5vw, 0.85rem);
    --fs-sm: clamp(0.8rem, 1.8vw, 0.95rem);
    --fs-md: clamp(0.9rem, 2vw, 1.05rem);
    --fs-lg: clamp(1rem, 2.5vw, 1.25rem);
    --fs-xl: clamp(1.1rem, 3vw, 1.5rem);
    --fs-2xl: clamp(1.3rem, 4vw, 2rem);
    --fs-title: clamp(1.5rem, 5vw, 2.6rem);
}

html, body {
    height: 100%;
    width: 100%;
     
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a3d62 0%, #1e90ff 50%, #00bfff 100%);
    background-size: 200% 200%;
    min-height: 100vh;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: backgroundShift 10s ease infinite;
}

@keyframes backgroundShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}
@keyframes bounce {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 120%; }
}
@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* =============================================
   CONTAINER PRINCIPAL
   ============================================= */
.container {
    width: min(960px, 96vw);
    height: min(96vh, 860px);
    background: white;
    border-radius: 22px;
    padding: clamp(12px, 2.5vw, 32px);
    box-shadow: 0 24px 64px rgba(0,0,0,0.28), 0 0 40px rgba(30,144,255,0.15);
    animation: slideIn 0.55s ease-out;
    display: flex;
    flex-direction: column;
}

/* =============================================
   HEADER
   ============================================= */
.header {
    text-align: center;
    flex-shrink: 0;
    margin-bottom: clamp(6px, 1.5vh, 18px);
}

h1 {
    color: var(--primary-dark);
    font-size: var(--fs-title);
    animation: float 3.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    line-height: 1.1;
}

.header p { color: #888; font-size: var(--fs-sm); margin-top: 2px; }

.header-subtitle {
    font-size: var(--fs-xs);
    color: #aaa;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 3px;
}

/* =============================================
   VUES
   ============================================= */
.mode-selection,
.quiz,
.results,
#searchMode {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.mode-selection { display: flex; }
.quiz.active { display: flex; }
.results.active { display: flex; }
#searchMode { display: none; }

/* =============================================
   MODE SELECTION
   ============================================= */
.mode-selection {
    gap: clamp(8px, 1.5vh, 16px);
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.mode-selection::-webkit-scrollbar { display: none; }

.settings-panel {
    background: linear-gradient(135deg, #fafcff 0%, #f0f8ff 100%);
    padding: clamp(10px, 1.8vw, 16px);
    border-radius: var(--radius);
    border: 1.5px solid rgba(30,144,255,0.25);
    flex-shrink: 0;
}

.settings-panel h3 {
    color: var(--primary-dark);
    margin-bottom: 10px;
    font-size: var(--fs-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-settings-toggle {
    background: linear-gradient(135deg, #607d8b 0%, #455a64 100%);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: var(--fs-xs);
}

.btn-settings-toggle:hover {
    background: linear-gradient(135deg, #455a64 0%, #37474f 100%);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.setting-item input[type="checkbox"] {
    width: 18px; height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.setting-item label {
    cursor: pointer;
    color: #333;
    font-weight: 500;
    font-size: var(--fs-sm);
}

.import-label { font-weight: 600; }

.qcm-library {
    margin: 10px 0 8px;
    padding: 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(30,144,255,0.28);
    background: linear-gradient(135deg, #f4faff 0%, #eaf5ff 100%);
}

.qcm-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.qcm-library h4 {
    color: var(--primary-dark);
    margin: 0;
    font-size: var(--fs-sm);
}

.qcm-library-controls {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.qcm-select {
    flex: 1 1 260px;
    min-width: 220px;
    border: 1.5px solid #b7d7ff;
    border-radius: 8px;
    background: #fff;
    color: #0a3d62;
    font-size: var(--fs-sm);
    padding: 6px 9px;
}

.qcm-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,144,255,0.2);
}

.exam-settings {
    margin: 10px 0 6px;
    padding: 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(255,152,0,0.35);
    background: linear-gradient(135deg, #fffaf0 0%, #fff3df 100%);
}

.exam-settings h4 {
    color: #b35d00;
    margin-bottom: 0;
    font-size: var(--fs-sm);
}

.exam-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.exam-settings-content {
    margin-top: 8px;
}

.exam-setting-item {
    justify-content: space-between;
}

.exam-number-input {
    width: 86px;
    border: 1.5px solid #ffd08a;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #8a4b00;
    background: #fff;
}

.exam-number-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,152,0,0.2);
}

.file-input {
    cursor: pointer;
    font-size: var(--fs-sm);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1.5px dashed var(--primary);
    background: rgba(30,144,255,0.04);
    color: var(--primary-dark);
    transition: background var(--transition);
}
.file-input:hover { background: rgba(30,144,255,0.1); }
.import-status { margin-top: 8px; font-size: var(--fs-xs); }

.mode-cards {
    display: flex;
    gap: clamp(8px, 1.8vw, 16px);
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.mode-card {
    flex: 1 1 150px;
    min-width: 130px;
    max-width: 250px;
    padding: clamp(10px, 1.8vw, 20px) clamp(8px, 1.3vw, 16px);
    border: 1.5px solid #e4efff;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    background: white;
    position: relative;
    overflow: hidden;
     
}

/* Accent coloré en haut selon le mode */
.mode-card[data-mode="training"] { box-shadow: inset 0 4px 0 var(--primary); }
.mode-card[data-mode="exam"]     { box-shadow: inset 0 4px 0 var(--accent); }
.mode-card[data-mode="search"]   { box-shadow: inset 0 4px 0 var(--success); }

.mode-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 3.5s infinite;
    pointer-events: none;
}

.mode-card:hover {
    border-color: #c0d8ff;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
    transform: translateY(-5px) scale(1.02);
    box-shadow: inset 0 4px 0 var(--primary), 0 12px 32px rgba(30,144,255,0.22);
}

.mode-card[data-mode="exam"]:hover     { box-shadow: inset 0 4px 0 var(--accent), 0 12px 32px rgba(255,152,0,0.2); }
.mode-card[data-mode="search"]:hover   { box-shadow: inset 0 4px 0 var(--success), 0 12px 32px rgba(76,175,80,0.2); }

.mode-card h3 {
    color: var(--primary-dark);
    margin-bottom: 8px;
    font-size: var(--fs-lg);
}

.mode-card p {
    color: #555;
    font-size: var(--fs-xs);
    line-height: 1.5;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* =============================================
   BOUTONS
   ============================================= */
button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: clamp(7px, 1.1vh, 12px) clamp(12px, 2.2vw, 24px);
    font-size: var(--fs-sm);
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
     
    white-space: nowrap;
}

button::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    pointer-events: none;
}

button:hover::before { width: 280px; height: 280px; }

button:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 8px 22px rgba(30,144,255,0.35);
    transform: translateY(-2px);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}
button:disabled::before { display: none; }

.btn-skip { background: linear-gradient(135deg, var(--accent) 0%, #ff6b00 100%); }
.btn-skip:hover { background: linear-gradient(135deg, #ff6b00 0%, var(--accent) 100%); }

.btn-reset { background: linear-gradient(135deg, #607d8b 0%, #455a64 100%); }
.btn-reset:hover { background: linear-gradient(135deg, #455a64 0%, #37474f 100%); }

/* =============================================
   QUIZ
   ============================================= */
.quiz {
    gap: clamp(6px, 1.2vh, 12px);
}

/* Barre de progression "question X/N" */
.quiz-progress {
    height: 5px;
    background: rgba(30,144,255,0.12);
    border-radius: 5px;
    margin: 1em;
    flex-shrink: 0;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 5px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.timer {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe5a1 100%);
    font-weight: bold;
    font-size: var(--fs-lg);
    text-align: center;
    padding: clamp(5px, 1vh, 10px);
    color: #ff6b00;
    border-radius: var(--radius);
    border: 2px solid #ff9800;
    animation: timerPulse 1s infinite;
    flex-shrink: 0;
}

.timer.warning {
    color: var(--danger);
    border-color: var(--danger);
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.timer.safe {
    color: var(--success);
    border-color: var(--success);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.question-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
    color: white;
    padding: clamp(10px, 1.6vh, 16px) clamp(12px, 2vw, 20px);
    border-radius: var(--radius);
    animation: fadeIn 0.4s ease-out;
    flex-shrink: 0;
    box-shadow: 0 4px 18px rgba(30,144,255,0.28);
}

.question-number {
    font-weight: bold;
    font-size: var(--fs-xs);
    opacity: 0.9;
    margin-bottom: 5px;
}

.question-text {
    font-size: var(--fs-xl);
    font-weight: bold;
    line-height: 1.4;
}

.question-media {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.28);
}

.question-media img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
}

.hint-box {
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: var(--fs-xs);
    font-style: italic;
}

/* =============================================
   OPTIONS (QCM)
   ============================================= */
.options {
    display: flex;
    flex-direction: column;
    gap: clamp(5px, 0.9vh, 9px);
    flex: 1;
    min-height: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-right: 2px;
    counter-reset: opt-counter;
}
.options::-webkit-scrollbar { display: none; }

.option {
    display: flex;
    align-items: center;
    padding: clamp(7px, 1.3vh, 13px) clamp(10px, 1.6vw, 15px);
    border: 2px solid #eaeaea;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    background-color: #fafafa;
    flex-shrink: 0;
    counter-increment: opt-counter;
}

/* Badge lettre A / B / C ... */
.option::before {
    content: counter(opt-counter, upper-alpha);
    min-width: clamp(22px, 3vw, 28px);
    height: clamp(22px, 3vw, 28px);
    border-radius: 50%;
    background: #e8e8e8;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.72rem;
    margin-right: 12px;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}

.option.selected::before  { background: var(--primary);  color: white; }
.option.correct::before   { background: var(--success);  color: white; }
.option.incorrect::before { background: var(--danger);   color: white; }

.option:hover:not(.disabled) {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
    transform: translateX(4px);
    box-shadow: 0 4px 14px rgba(30,144,255,0.18);
}

.option.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #e8f3ff 0%, #d6ebff 100%);
    box-shadow: 0 0 0 3px rgba(30,144,255,0.12);
}

.option.correct  {
    border-color: var(--success);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    animation: pulse 0.4s ease;
}

.option.incorrect {
    border-color: var(--danger);
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    animation: shake 0.4s ease;
}

.option.disabled { cursor: not-allowed; opacity: 0.75; }

/* Masquer l'input natif, la sélection est gérée par JS + ::before badge */
.option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.option label {
    flex-grow: 1;
    cursor: pointer;
    font-size: var(--fs-sm);
    line-height: 1.4;
}

/* =============================================
   FEEDBACK & BOUTONS QUIZ
   ============================================= */
.feedback {
    padding: clamp(7px, 1.3vh, 14px) clamp(12px, 2vw, 18px);
    border-radius: 10px;
    font-style: italic;
    font-size: var(--fs-sm);
    animation: fadeIn 0.4s ease-out;
    flex-shrink: 0;
    line-height: 1.5;
}

.feedback.correct {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left: 5px solid var(--success);
    color: #2e7d32;
}

.feedback.incorrect {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 5px solid var(--danger);
    color: #c62828;
}

.buttons {
    display: flex;
    gap: 10px;
    margin-top: 1em;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* =============================================
   RÉSULTATS
   ============================================= */
.results {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: clamp(8px, 1.4vh, 14px);
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.results::-webkit-scrollbar { display: none; }

.results h2 {
    font-size: var(--fs-2xl);
    color: var(--primary-dark);
    flex-shrink: 0;
}

.score-circle {
    width: clamp(90px, 18vw, 150px);
    height: clamp(90px, 18vw, 150px);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: clamp(1.3rem, 4vw, 2.6rem);
    font-weight: bold;
    box-shadow:
        0 0 0 6px rgba(255,255,255,0.55),
        0 0 0 14px rgba(30,144,255,0.15),
        0 8px 36px rgba(30,144,255,0.42);
    animation: bounce 0.55s ease-out;
    flex-shrink: 0;
}

.results-stats {
    width: 100%;
    max-width: 520px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    flex-shrink: 0;
}

.results-stats div {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
    border-radius: 10px;
    padding: clamp(10px, 1.5vw, 14px) clamp(8px, 1.2vw, 12px);
    text-align: center;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #333;
    border: 1.5px solid #ddeeff;
    box-shadow: 0 2px 8px rgba(30,144,255,0.07);
}

.status-message {
    font-size: var(--fs-lg);
    font-weight: bold;
    color: var(--primary-dark);
    animation: slideIn 0.55s ease-out;
    flex-shrink: 0;
}

.mistakes-section {
    width: 100%;
    background: linear-gradient(135deg, #fff3cd 0%, #ffe5a1 100%);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: clamp(10px, 1.6vw, 16px);
    overflow-y: auto;
    max-height: 35vh;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.mistakes-section::-webkit-scrollbar { display: none; }

.mistakes-section h3 {
    color: #ff6b00;
    margin-bottom: 10px;
    font-size: var(--fs-lg);
}

.mistake-item {
    background: white;
    padding: clamp(7px, 1.3vh, 12px);
    border-radius: 10px;
    margin: 7px 0;
    border-left: 4px solid var(--danger);
}

.mistake-question {
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 5px;
    font-size: var(--fs-sm);
}

.mistake-details {
    font-size: var(--fs-xs);
    color: #555;
    line-height: 1.5;
}

.mistake-details span { display: block; margin: 3px 0; }
.time-over-message { margin-bottom: 10px; }

/* =============================================
   RECHERCHE
   ============================================= */
#searchMode {
    flex-direction: column;
    gap: 10px;
}

.search-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: clamp(10px, 1.6vh, 16px) clamp(12px, 2vw, 18px);
    border-radius: var(--radius);
    flex-shrink: 0;
}

.search-header h2 {
    margin-bottom: 10px;
    font-size: var(--fs-xl);
}

.search-input {
    width: 100%;
    padding: clamp(7px, 1.1vh, 11px);
    border-radius: 8px;
    border: none;
    font-size: var(--fs-sm);
    outline: none;
}

#searchResults {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
#searchResults::-webkit-scrollbar { display: none; }

.search-result-item {
    background: white;
    padding: clamp(10px, 1.6vh, 16px);
    border-radius: 10px;
    margin: 8px 0;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.4s ease-out;
}

.search-result-question {
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 8px;
    font-size: var(--fs-sm);
}

.search-choice-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.search-choice {
    color: #555;
    padding: 5px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    border: 2px solid transparent;
    font-size: var(--fs-xs);
    transition: all var(--transition);
}

.search-choice.correct-answer {
    border: 2.5px solid var(--success);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    font-weight: bold;
    color: #2e7d32;
    box-shadow: 0 0 8px rgba(76,175,80,0.25);
}

.no-results {
    text-align: center;
    color: #666;
    padding: 12px;
    font-size: var(--fs-sm);
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 9999;
    overflow: auto;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    width: min(90vw, 700px);
    max-height: 88vh;
    padding: clamp(14px, 2.5vw, 28px);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    overflow: auto;
    margin: auto;
}

.modal-content h2 {
    color: var(--primary-dark);
    margin-bottom: 16px;
    font-size: var(--fs-xl);
}

.modal-content ul {
    font-size: var(--fs-sm);
    line-height: 1.8;
    list-style: none;
}

.modal-content li {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
    padding: 11px;
    border-radius: 10px;
    margin: 8px 0;
    border-left: 4px solid var(--primary);
}

/* =============================================
   TYPE : RELIER DES ÉLÉMENTS (matching)
   ============================================= */
.matching-wrapper {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
}

.matching-container {
    display: flex;
    gap: clamp(8px, 2vw, 18px);
    flex: 1;
    align-items: stretch;
    min-height: 0;
    width: 100%;
}

.matching-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(5px, 0.9vh, 9px);
    min-height: 0;
    scrollbar-width: none;
}
.matching-col::-webkit-scrollbar { display: none; }

.matching-col-title {
    font-weight: bold;
    color: var(--primary-dark);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 3px;
    flex-shrink: 0;
}

.match-item {
    padding: clamp(7px, 1.3vh, 12px) clamp(9px, 1.4vw, 13px);
    border-radius: 10px;
    border: 2.5px solid #d0d0d0;
    background: #f7f7f7;
    cursor: pointer;
    font-size: var(--fs-sm);
    transition: all var(--transition);
    text-align: center;
    line-height: 1.35;
    -webkit-user-select: none;
    user-select: none;
    flex-shrink: 0;
    position: relative;
}

.match-item:hover:not(.used):not(.disabled-match) {
    border-color: var(--primary);
    background: var(--bg-card);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(30,144,255,0.2);
}

.match-item.selected-left {
    border-color: var(--primary);
    background: linear-gradient(135deg, #c8e0ff 0%, #b0ccff 100%);
    box-shadow: 0 0 12px rgba(30,144,255,0.3);
}

.match-item.matched {
    border-color: var(--success);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    font-weight: 600;
}

.match-item.match-linked {
    border-color: var(--match-link-color, var(--success));
    box-shadow: inset 0 0 0 1px var(--match-link-color, #1e90ff);
}

.match-item.match-correct {
    border-color: var(--success);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    animation: pulse 0.4s ease;
}

.match-item.match-incorrect {
    border-color: var(--danger);
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    animation: shake 0.4s ease;
}

.match-item.disabled-match { cursor: not-allowed; opacity: 0.72; }
.match-item.used { opacity: 0.32; cursor: default; pointer-events: none; }

.matched-label {
    font-size: var(--fs-xs);
    color: var(--primary-dark);
    font-style: italic;
    display: block;
    margin-top: 3px;
}

.matching-svg-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* =============================================
   TYPE : FILL-IN-THE-BLANK (glisser-déposer)
   ============================================= */
.fillblank-container {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1.2vh, 12px);
    flex: 1;
     
    min-height: 0;
}

.fillblank-sentences {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(5px, 1vh, 10px);
    min-height: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.fillblank-sentences::-webkit-scrollbar { display: none; }

.fillblank-sentence {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
    border: 2px solid #c0d8f0;
    border-radius: 10px;
    padding: clamp(8px, 1.4vh, 13px) clamp(10px, 1.6vw, 15px);
    font-size: var(--fs-sm);
    line-height: 1.9;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 4px;
    transition: border-color var(--transition);
    flex-shrink: 0;
}

.fillblank-sentence.correct-sentence {
    border-color: var(--success);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.fillblank-sentence.incorrect-sentence {
    border-color: var(--danger);
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.blank-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(65px, 11vw, 115px);
    height: clamp(26px, 3.8vh, 34px);
    border-radius: 8px;
    border: 2.5px dashed var(--primary);
    background: rgba(30,144,255,0.06);
    transition: all var(--transition);
    position: relative;
    cursor: default;
    flex-shrink: 0;
}

.blank-slot.drag-over {
    border-color: var(--accent);
    background: rgba(255,152,0,0.12);
    transform: scale(1.04);
}

.blank-slot.filled {
    border-style: solid;
    border-color: var(--primary);
    background: linear-gradient(135deg, #d0e8ff 0%, #b8d4ff 100%);
}

.blank-slot.correct-slot {
    border-color: var(--success);
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
}

.blank-slot.incorrect-slot {
    border-color: var(--danger);
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
}

.blank-slot .slot-content {
    font-size: var(--fs-xs);
    font-weight: bold;
    color: var(--primary-dark);
    padding: 0 5px;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}

.blank-slot .slot-remove {
    position: absolute;
    top: -7px; right: -7px;
    width: 16px; height: 16px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
    transition: transform var(--transition);
}

.blank-slot .slot-remove:hover { transform: scale(1.25); }

.fillblank-bank-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.fillblank-bank {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(5px, 0.9vw, 8px);
    padding: clamp(7px, 1.3vh, 11px);
    border-radius: var(--radius);
    border: 2px solid var(--primary);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
    flex-shrink: 0;
    align-content: flex-start;
    min-height: clamp(40px, 7vh, 64px);
}

.bank-token {
    padding: clamp(4px, 0.8vh, 7px) clamp(8px, 1.4vw, 13px);
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-size: var(--fs-xs);
    font-weight: bold;
    cursor: grab;
    transition: all var(--transition);
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(30,144,255,0.25);
}

.bank-token:active { cursor: grabbing; }
.bank-token:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(30,144,255,0.35);
}

.bank-token.used-token {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.bank-token.dragging { opacity: 0.5; transform: scale(0.95); }

.bank-token.token-selected {
    background: linear-gradient(135deg, var(--accent) 0%, #ff6b00 100%);
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(255,152,0,0.4);
}

/* =============================================
   UTILITAIRES
   ============================================= */
.hidden { display: none !important; }
.active { display: block !important; }
.text-center { text-align: center; }
.mt-30 { margin-top: 16px; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-height: 600px) {
    .container { padding: 8px 12px; }
    .header { margin-bottom: 3px; }
    .mode-card { padding: 7px 9px; }
}

@media (max-width: 480px) {
    .matching-container { flex-direction: column; }
    .matching-col { max-height: 33vh; }
    .mode-cards { gap: 7px; }
    .mode-card { min-width: 110px; padding: 9px; }
}

@media (max-width: 360px) {
    .buttons { gap: 5px; }
    button { padding: 6px 10px; font-size: 0.75rem; }
}


