/* Design moderne pour les exercices Replace avec couleurs principales #00d9ff et blanc + couleurs vives */

/* Container principal */
.interactif-replace-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 28px;
    margin: 20px 0;
    box-shadow: 0 12px 40px rgba(0, 217, 255, 0.15);
    border: 2px solid rgba(0, 217, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.interactif-replace-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #00d9ff, #8b5cf6, #ec4899, #10b981, #f97316, #00d9ff);
    background-size: 300% 100%;
    animation: rainbow-shimmer 4s ease-in-out infinite;
}

@keyframes rainbow-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.interactif-replace-container:hover {
    box-shadow: 0 16px 50px rgba(0, 217, 255, 0.25);
    transform: translateY(-3px);
    border-color: #00d9ff;
}

/* Titre et contenu de l'exercice */
.exercise-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.3;
    color: #1e293b;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    padding-bottom: 12px;
}

.exercise-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #00d9ff, #8b5cf6, #ec4899);
    border-radius: 2px;
    animation: title-glow 2s ease-in-out infinite alternate;
}

@keyframes title-glow {
    from { box-shadow: 0 0 10px rgba(0, 217, 255, 0.5); }
    to { box-shadow: 0 0 20px rgba(139, 92, 246, 0.7); }
}

.exercise-instructions {
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
    border: 3px solid #00d9ff;
    border-left: 8px solid #8b5cf6;
    padding: 20px 24px;
    margin: 24px 0;
    border-radius: 16px;
    font-size: 16px;
    line-height: 1.7;
    color: #334155;
    position: relative;
    box-shadow: 0 6px 24px rgba(0, 217, 255, 0.12);
}

.exercise-instructions::before {
    content: '📋';
    font-size: 24px;
    margin-right: 12px;
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0, 217, 255, 0.3));
}

/* Container d'image amélioré */
.exercise-image-container {
    text-align: center;
    margin: 24px 0;
    padding: 24px;
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
    border-radius: 20px;
    border: 3px solid rgba(0, 217, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.exercise-image-container:hover {
    border-color: #00d9ff;
    box-shadow: 0 12px 40px rgba(0, 217, 255, 0.2);
    background: linear-gradient(135deg, #ffffff, #f0f9ff, #fdf2f8);
}

.exercise-image {
    max-width: 100%;
    max-height: 320px;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 217, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 4px solid #ffffff;
}

.exercise-image:hover {
    transform: scale(1.03) rotate(1deg);
    box-shadow: 0 15px 45px rgba(139, 92, 246, 0.3);
}

.image-caption {
    margin-top: 16px;
    font-size: 15px;
    color: #64748b;
    font-style: italic;
    font-weight: 600;
    background: linear-gradient(135deg, #00d9ff, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Banque de mots redesignée */
.interactif-word-bank {
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
    border: 3px solid #00d9ff;
    border-radius: 20px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.12);
    position: relative;
}

.interactif-word-bank::before {
    content: "🏷️";
    font-size: 28px;
    margin-right: 16px;
    filter: drop-shadow(0 3px 6px rgba(0, 217, 255, 0.4));
}

.interactif-word-bank-title {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #00d9ff, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.interactif-word-bank-words {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.interactif-word-bank-word {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    color: #1e293b;
    border: 3px solid #00d9ff;
    border-radius: 30px;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.15);
    backdrop-filter: blur(10px);
}

.interactif-word-bank-word::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactif-word-bank-word:hover {
    background: linear-gradient(135deg, #00d9ff, #8b5cf6);
    color: white;
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 12px 35px rgba(0, 217, 255, 0.4);
    border-color: #8b5cf6;
}

.interactif-word-bank-word:hover::before {
    left: 100%;
}

.interactif-word-bank-word:active {
    transform: translateY(-2px) scale(1.05);
}

.interactif-word-bank-word.used {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #94a3b8;
    border-color: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
}

.interactif-word-bank-word[data-multiple="true"]::after {
    content: "∞";
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ec4899, #f97316);
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    box-shadow: 0 3px 12px rgba(236, 72, 153, 0.4);
    animation: pulse-infinite 2s infinite;
}

@keyframes pulse-infinite {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Container des phrases redesigné */
.interactif-replace-sentences {
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.interactif-replace-sentence {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 3px solid rgba(0, 217, 255, 0.25);
    border-radius: 20px;
    padding: 24px;
    flex-wrap: wrap;
    display: flex;
    
    line-height: 1.8;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 24px rgba(0, 217, 255, 0.1);
    color: #334155;
    align-items: center;
    margin-top: 10px;
}

.interactif-replace-sentence:hover {
    border-color: #00d9ff;
    box-shadow: 0 10px 35px rgba(0, 217, 255, 0.18);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
}

.interactif-replace-sentence::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 6px;
    background: linear-gradient(135deg, #00d9ff, #8b5cf6, #ec4899);
    border-radius: 0 12px 12px 0;
    opacity: 0;
    transition: all 0.4s ease;
}

.interactif-replace-sentence:hover::before {
    opacity: 1;
    animation: gradient-flow 2s ease-in-out infinite;
}

@keyframes gradient-flow {
    0%, 100% { background: linear-gradient(135deg, #00d9ff, #8b5cf6); }
    50% { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
}

/* Design amélioré pour sentence-hint */
.sentence-hint {
    background: linear-gradient(135deg, #f0f9ff, #fdf2f8);
    color: #8b5cf6;
    font-style: italic;
    font-size: 14px;
    font-weight: 700;
    margin-top: 10px;
    margin-left: 12px;
    padding: 6px 16px;
    border-radius: 20px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.15);
    backdrop-filter: blur(5px);
}

.sentence-hint::before {
    content: "💭";
    font-size: 16px;
    filter: drop-shadow(0 1px 3px rgba(139, 92, 246, 0.3));
}

.sentence-hint:hover {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: white;
    border-color: #ec4899;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
}

.sentence-hint::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #00d9ff, #8b5cf6, #ec4899, #10b981);
    border-radius: 22px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sentence-hint:hover::after {
    opacity: 0.3;
    animation: rotate-border 3s linear infinite;
}

@keyframes rotate-border {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Champs de saisie modernisés */
.interactif-replace-blank {
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
    border: 3px solid #00d9ff;
    border-radius: 16px;
    max-width: 180px;
    margin: 0 12px;
    padding: 4px 18px;
    font-size: 17px;
    max-height: 50px;
    font-weight: 700;
    color: #1e293b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.12);
    backdrop-filter: blur(8px);
}

.interactif-replace-blank:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 5px rgba(139, 92, 246, 0.2), 0 10px 30px rgba(0, 217, 255, 0.2);
    background: linear-gradient(135deg, #ffffff, #fdf2f8);
    transform: scale(1.08);
}

.interactif-replace-blank:hover {
    border-color: #8b5cf6;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.25);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
}

.interactif-replace-blank.active {
    border-color: #ec4899;
    background: linear-gradient(135deg, #fdf2f8, #ffffff);
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.3);
    animation: active-rainbow-pulse 3s infinite;
}

@keyframes active-rainbow-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.4), 0 10px 30px rgba(0, 217, 255, 0.2); 
        border-color: #00d9ff;
    }
    33% { 
        box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.4), 0 12px 35px rgba(139, 92, 246, 0.25); 
        border-color: #8b5cf6;
    }
    66% { 
        box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.4), 0 10px 30px rgba(236, 72, 153, 0.2); 
        border-color: #ec4899;
    }
}

/* États de correction améliorés avec couleurs vives */
.interactif-replace-blank.correct {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: #10b981;
    color: #065f46;
    animation: success-celebration 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.interactif-replace-blank.incorrect {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border-color: #ef4444;
    color: #dc2626;
    animation: error-shake 0.6s ease-in-out;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.interactif-replace-blank.partial {
    background: linear-gradient(135deg, #fff7ed, #fed7aa);
    border-color: #f97316;
    color: #c2410c;
    animation: partial-shimmer 1s ease-in-out;
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
}

@keyframes success-celebration {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    40% { transform: translateY(-12px) scale(1.15) rotate(2deg); }
    60% { transform: translateY(-6px) scale(1.08) rotate(-1deg); }
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-6px) rotate(-2deg); }
    75% { transform: translateX(6px) rotate(2deg); }
}

@keyframes partial-shimmer {
    0%, 100% { 
        box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3); 
        background: linear-gradient(135deg, #fff7ed, #fed7aa);
    }
    50% { 
        box-shadow: 0 12px 35px rgba(249, 115, 22, 0.5); 
        background: linear-gradient(135deg, #fed7aa, #fff7ed);
    }
}

/* Réponses correctes avec design amélioré */
.correct-answer {
    display: inline-flex;
    align-items: center;
    margin: 0px;
    color: #065f46;
    font-weight: 800;
    font-size: 15px;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    padding: 6px 16px;
    border-radius: 25px;
    border: 3px solid #10b981;
    animation: fadeInCelebrate 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
    position: relative;
}

.correct-answer::before {
    content: '✨';
    margin-right: 6px;
    font-size: 16px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
}

.correct-arrow {
    color: #00d9ff;
    font-weight: 900;
    font-size: 22px;
    margin: 0 8px;
    animation: arrow-bounce 1.5s ease-in-out infinite;
}

@keyframes arrow-bounce {
    0%, 100% { transform: translateX(0px); }
    50% { transform: translateX(4px); }
}

@keyframes fadeInCelebrate {
    from { 
        opacity: 0; 
        transform: translateY(-15px) scale(0.8) rotate(-5deg); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1) rotate(0deg); 
    }
}

/* Messages de feedback redesignés avec couleurs vives */
.feedback-perfect {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0, #d1fae5);
    color: #065f46;
    border: 4px solid #10b981;
    border-radius: 20px;
    padding: 24px 28px;
    margin: 24px 0;
    font-weight: 800;
    font-size: 18px;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: perfectSlideIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.25);
}

.feedback-perfect::before {
    content: "🎉";
    font-size: 28px;
    margin-right: 16px;
    animation: celebration-bounce 2s ease-in-out infinite;
}

.feedback-perfect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: sweep-light 3s ease-in-out infinite;
}

@keyframes celebration-bounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.3) rotate(15deg); }
}

@keyframes sweep-light {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.feedback-good {
    background: linear-gradient(135deg, #fff7ed, #fed7aa, #fdba74);
    color: #c2410c;
    border: 4px solid #f97316;
    border-radius: 20px;
    padding: 24px 28px;
    margin: 24px 0;
    font-weight: 800;
    font-size: 18px;
    text-align: center;
    animation: goodSlideIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 12px 35px rgba(249, 115, 22, 0.25);
}

.feedback-good::before {
    content: "👍";
    font-size: 26px;
    margin-right: 16px;
    animation: thumbs-wiggle 1.5s ease-in-out infinite;
}

@keyframes thumbs-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.feedback-try-again {
    background: linear-gradient(135deg, #fef2f2, #fecaca, #fca5a5);
    color: #dc2626;
    border: 4px solid #ef4444;
    border-radius: 20px;
    padding: 24px 28px;
    margin: 24px 0;
    font-weight: 800;
    font-size: 18px;
    text-align: center;
    animation: tryAgainSlideIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 12px 35px rgba(239, 68, 68, 0.25);
}

.feedback-try-again::before {
    content: "💪";
    font-size: 26px;
    margin-right: 16px;
    animation: muscle-flex 2s ease-in-out infinite;
}

@keyframes muscle-flex {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes perfectSlideIn {
    from { 
        transform: translateY(30px) scale(0.9); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
}

@keyframes goodSlideIn {
    from { 
        transform: translateY(25px) rotateX(-10deg); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0) rotateX(0deg); 
        opacity: 1; 
    }
}

@keyframes tryAgainSlideIn {
    from { 
        transform: translateX(-30px) rotate(-3deg); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0) rotate(0deg); 
        opacity: 1; 
    }
}

.score-value {
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
    border: 3px solid #00d9ff;
    padding: 8px 18px;
    border-radius: 25px;
    font-weight: 900;
    margin-left: 12px;
    color: #00d9ff;
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.25);
    animation: score-pulse 2s ease-in-out infinite;
}

@keyframes score-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 6px 20px rgba(0, 217, 255, 0.25); }
    50% { transform: scale(1.05); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3); }
}

/* Explication redesignée */
.exercise-explanation-container {
    margin-top: 28px;
    padding: 0;
}

.explanation-title {
    font-weight: 800;
    font-size: 20px;
    color: #1e293b;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #00d9ff, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.explanation-title::before {
    content: "💡";
    font-size: 26px;
    margin-right: 12px;
    filter: drop-shadow(0 3px 6px rgba(0, 217, 255, 0.4));
    animation: bulb-glow 3s ease-in-out infinite;
}

@keyframes bulb-glow {
    0%, 100% { filter: drop-shadow(0 3px 6px rgba(0, 217, 255, 0.4)); }
    50% { filter: drop-shadow(0 5px 12px rgba(139, 92, 246, 0.6)); }
}

.exercise-explanation {
    background: linear-gradient(135deg, #ffffff, #f0f9ff, #fdf2f8);
    border: 3px solid #00d9ff;
    border-left: 8px solid #8b5cf6;
    border-radius: 20px;
    padding: 24px 28px;
    color: #334155;
    line-height: 1.8;
    font-size: 16px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.12);
}

/* Responsive Design amélioré */
@media (max-width: 768px) {
    .interactif-replace-container {
        padding: 24px;
        margin: 16px 8px;
        border-radius: 18px;
    }
    
    .exercise-title {
        font-size: 24px;
        margin-bottom: 16px;
    }
    
    .exercise-instructions {
        padding: 18px 22px;
        margin: 20px 0;
        font-size: 15px;
    }
    
    .exercise-image-container {
        margin: 20px 0;
        padding: 20px;
    }
    
    .exercise-image {
        max-height: 250px;
    }
    
    .interactif-word-bank {
        padding: 20px;
        margin: 20px 0;
    }
    
    .interactif-word-bank-title {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .interactif-word-bank-words {
        gap: 12px;
        justify-content: flex-start;
    }
    
    .interactif-word-bank-word {
        padding: 10px 20px;
        font-size: 15px;
        border-radius: 25px;
    }
    
    .interactif-replace-sentences {
        gap: 16px;
    }
    
    .interactif-replace-sentence {
        padding: 20px;
        font-size: 14px;
        border-radius: 16px;
    }
    
    .sentence-hint {
        margin-left: 8px;
        padding: 5px 12px;
        font-size: 13px;
    }
    
    .interactif-replace-blank {
        min-width: 100px;
        font-size: 16px;
        padding: 5px 16px;
        margin: 0 8px;
    }
    
    .feedback-perfect, .feedback-good, .feedback-try-again {
        padding: 20px 24px;
        margin: 20px 0;
        font-size: 16px;
    }
    
    .exercise-explanation {
        padding: 20px 24px;
        font-size: 15px;
    }
}

/* Responsive ultra-petit (smartphones) */
@media (max-width: 480px) {
    .interactif-replace-container {
        padding: 20px;
        margin: 12px 4px;
    }
    
    .exercise-title {
        font-size: 22px;
        margin-bottom: 14px;
    }
    
    .interactif-word-bank {
        padding: 18px;
        margin: 18px 0;
    }
    
    .interactif-word-bank-words {
        gap: 10px;
    }
    
    .interactif-word-bank-word {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .interactif-replace-sentence {
        padding: 18px;
        font-size: 14px;
    }
    
    .sentence-hint {
        margin-left: 6px;
        padding: 4px 10px;
        font-size: 12px;
        margin-top: 8px;
        margin-bottom: 8px;
    }
    
    .interactif-replace-blank {
        min-width: 80px;
        font-size: 15px;
        padding: 4px 14px;
        margin: 4px 6px;
    }
    
    .exercise-explanation {
        padding: 18px 20px;
        font-size: 14px;
    }
}

/* Support RTL pour l'arabe avec couleurs vives */
[dir="rtl"] .interactif-word-bank::before {
    margin-left: 16px;
    margin-right: 0;
}

[dir="rtl"] .interactif-word-bank-title::before {
    margin-left: 16px;
    margin-right: 0;
}

[dir="rtl"] .correct-arrow {
    margin-left: 12px;
    margin-right: 0;
    transform: scaleX(-1);
}

[dir="rtl"] .explanation-title::before {
    margin-left: 12px;
    margin-right: 0;
}

[dir="rtl"] .feedback-perfect::before,
[dir="rtl"] .feedback-good::before,
[dir="rtl"] .feedback-try-again::before {
    margin-left: 16px;
    margin-right: 0;
}

[dir="rtl"] .score-value {
    margin-right: 12px;
    margin-left: 0;
}

[dir="rtl"] .sentence-hint {
    margin-right: 12px;
    margin-left: 0;
}

[dir="rtl"] .correct-answer::before {
    margin-right: 0;
    margin-left: 6px;
}

/* Mode sombre optimisé avec couleurs vives */
@media (prefers-color-scheme: dark) {
    .interactif-replace-container {
        background: #1e293b;
        border-color: rgba(0, 217, 255, 0.4);
        color: #f1f5f9;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    }
    
    .interactif-replace-container::before {
        background: linear-gradient(90deg, #00d9ff, #8b5cf6, #ec4899, #10b981, #f97316, #00d9ff);
    }
    
    .exercise-title {
        color: #f1f5f9;
    }
    
    .exercise-title::after {
        background: linear-gradient(90deg, #00d9ff, #8b5cf6, #ec4899);
    }
    
    .exercise-instructions {
        background: linear-gradient(135deg, #334155, #475569);
        border-color: #00d9ff;
        border-left-color: #8b5cf6;
        color: #e2e8f0;
    }
    
    .exercise-image-container {
        background: linear-gradient(135deg, #334155, #475569);
        border-color: rgba(0, 217, 255, 0.4);
    }
    
    .interactif-replace-sentence {
        background: linear-gradient(135deg, #334155, #475569);
        border-color: rgba(0, 217, 255, 0.4);
        color: #f1f5f9;
    }
    
    .interactif-replace-sentence:hover {
        background: linear-gradient(135deg, #475569, #334155);
        border-color: #00d9ff;
    }
    
    .sentence-hint {
        background: linear-gradient(135deg, #475569, #334155);
        color: #c4b5fd;
        border-color: rgba(139, 92, 246, 0.5);
    }
    
    .sentence-hint:hover {
        background: linear-gradient(135deg, #8b5cf6, #ec4899);
        color: white;
    }
    
    .interactif-replace-blank {
        background: linear-gradient(135deg, #475569, #334155);
        border-color: #00d9ff;
        color: #f1f5f9;
    }
    
    .interactif-replace-blank:focus {
        border-color: #8b5cf6;
        background: linear-gradient(135deg, #334155, #475569);
    }
    
    .interactif-word-bank {
        background: linear-gradient(135deg, #334155, #475569);
        border-color: #00d9ff;
        color: #f1f5f9;
    }
    
    .interactif-word-bank-word {
        background: linear-gradient(135deg, #475569, #334155);
        color: #f1f5f9;
        border-color: #00d9ff;
    }
    
    .interactif-word-bank-word:hover {
        background: linear-gradient(135deg, #00d9ff, #8b5cf6);
        border-color: #8b5cf6;
    }
    
    .exercise-explanation {
        background: linear-gradient(135deg, #334155, #475569);
        border-color: #00d9ff;
        border-left-color: #8b5cf6;
        color: #e2e8f0;
    }
    
    .score-value {
        background: linear-gradient(135deg, #475569, #334155);
        border-color: #00d9ff;
        color: #00d9ff;
    }
    
    .image-caption {
        color: #c4b5fd;
    }
}

/* Animations supplémentaires pour l'engagement */
@keyframes floating {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

@keyframes rotate-hue {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes bounce-in {
    0% { transform: scale(0.3) rotate(-5deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Effets spéciaux pour l'interactivité */
.interactif-word-bank-word:nth-child(odd):hover {
    animation: floating 2s ease-in-out infinite;
}

.interactif-replace-blank:focus {
    animation: focus-glow 2s ease-in-out infinite;
}

@keyframes focus-glow {
    0%, 100% { box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.3), 0 10px 30px rgba(0, 217, 255, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.4), 0 12px 35px rgba(139, 92, 246, 0.25); }
}

/* Optimisations performance */
.interactif-replace-sentence,
.interactif-replace-blank,
.interactif-word-bank-word,
.sentence-hint {
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* États d'accessibilité améliorés */
.interactif-replace-blank:focus-visible {
    outline: 3px solid #ec4899;
    outline-offset: 2px;
}

.interactif-word-bank-word:focus-visible {
    outline: 3px solid #10b981;
    outline-offset: 2px;
}

/* Préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .interactif-replace-container::before,
    .tip-progress,
    .mini-bar,
    .sentence-hint::after,
    .exercise-title::after,
    .correct-answer::before,
    .correct-arrow,
    .feedback-perfect::before,
    .feedback-good::before,
    .feedback-try-again::before,
    .explanation-title::before,
    .score-value,
    .interactif-word-bank-word[data-multiple="true"]::after {
        animation: none;
    }
    
    .activity-card:hover,
    .adverbs-list li:hover,
    .sentence-hint:hover,
    .interactif-word-bank-word:hover,
    .interactif-replace-blank:hover {
        transform: none;
    }
    
    * {
        transition: none !important;
    }
}

/* Print styles avec couleurs optimisées */
@media print {
    .interactif-replace-container {
        box-shadow: none;
        border: 3px solid #000;
        margin: 16px 0;
        padding: 20px;
        background: #fff;
    }
    
    .interactif-replace-container::before {
        display: none;
    }
    
    .interactif-word-bank {
        border-color: #000;
        background: #fff;
    }
    
    .interactif-word-bank-word {
        border-color: #000;
        background: #fff;
        color: #000;
    }
    
    .interactif-replace-sentence {
        border-color: #000;
        background: #fff;
    }
    
    .interactif-replace-blank {
        border-color: #000;
        background: #fff;
        color: #000;
    }
    
    .sentence-hint {
        border-color: #000;
        background: #fff;
        color: #000;
        margin-top: 10px;
    }
    
    .exercise-explanation {
        border-color: #000;
        background: #fff;
        color: #000;
    }
}