/* ==========================================================================
   KEMELANG PREMIUM UI SYSTEM v1.0
   Design System Unifié pour l'Arène, les Parchemins et le Dictionnaire
   ========================================================================== */

/* --- 1. DESIGN TOKENS & VARIABLES --- */
:root {
    /* Couleurs Primaires (Identité Kemelang) */
    --keme-primary: #16a085;
    --keme-primary-hover: #11806a;
    --keme-primary-light: #f0fafa;
    --keme-secondary: #0d8a72;
    --km-primary: #1e293b;
    --km-accent: #0d8a72;
    /* Teinte chaude terre d'Afrique */
    --km-border: #e2e8f0;
    --km-bg-card: #ffffff;
    --km-radius: 12px;
    --km-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Couleurs de Statut & Feedback */
    --keme-success: #2ecc71;
    --keme-danger: #e74c3c;
    --keme-warning: #f1c40f;
    --keme-info: #3498db;

    /* Nuances de Neutres */
    --keme-dark: #1f2937;
    --keme-gray-text: #555555;
    --keme-light-gray: #f3f4f6;
    --keme-border: #e5e7eb;
    --keme-bg-canvas: #fafbfb;

    /* Typographie & Radius */
    --keme-font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --keme-font-serif: 'Playfair Display', Georgia, serif;
    --keme-radius-lg: 20px;
    --keme-radius-md: 12px;
    --keme-radius-sm: 8px;
    --keme-radius-full: 50px;

    /* Éléments de Profondeur (Look Premium) */
    --keme-shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.03);
    --keme-shadow-premium: 0 10px 25px rgba(0, 0, 0, 0.05);
    --keme-shadow-hover: 0 15px 35px rgba(22, 160, 133, 0.1);
    --keme-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. CONFIGURATION DE BASE --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.keme-app-theme {
    font-family: var(--keme-font-sans);
    background-color: var(--keme-bg-canvas);
    color: var(--keme-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.km-bg-grain {
    background-color: #f8fafc;
    font-family: 'Inter', sans-serif;
    color: var(--km-primary);
    padding: 3rem 1rem;
}

/* --- 3. CONTENEURS & CARDS (`keme-card`) --- */
.keme-container,
.kemelang-container {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    padding: 1em;
}

.km-container {
    max-width: 1100px;
    margin: 0 auto;
}

.km-title-serif {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.km-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    background: var(--km-bg-card);
    padding: 1.5rem;
    border-radius: var(--km-radius);
    border: 1px solid var(--km-border);
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Lignes de phrases dynamiques */
.km-phrase-row-old {
    display: grid;
    grid-template-columns: 2fr 1fr auto auto;
    gap: 1.5rem;
    align-items: center;
    background: var(--km-bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--km-radius);
    border: 1px solid var(--km-border);
    margin-bottom: 1rem;
    transition: var(--km-transition);
    animation: fadeIn 0.3s ease;
}

.km-phrase-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1.5rem;
    align-items: center;
    background: var(--km-bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--km-radius);
    border: 1px solid var(--km-border);
    margin-bottom: 1rem;
    transition: var(--km-transition);
    animation: fadeIn 0.3s ease;
}

.km-phrase-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Boutons audio circulaires intelligents */
.km-audio-trigger {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: var(--km-primary);
    cursor: pointer;
    transition: var(--km-transition);
}

.km-audio-trigger.recording {
    background: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

.km-audio-trigger.has-audio {
    background: #dcfce7;
    color: #15803d;
}

.km-btn-delete {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--km-transition);
}

.km-btn-delete:hover {
    color: #ef4444;
}

.km-actions-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

/* 2. Donner du souffle à l'intérieur de la carte descriptive */
.playground-card {
    padding: 20px 16px !important;
    margin-left: 0;
    margin-right: 0;
    border-radius: 12px;
    /* Adoucit les angles sur mobile */
}



/* 4. Ajuster l'encadré des règles pour qu'il s'aligne proprement */
.delf-rules-box {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 16px !important;
}

.keme-card {
    background: #ffffff;
    border-radius: var(--keme-radius-lg);
    box-shadow: var(--keme-shadow-premium);
    padding: 30px;
    border: 1px solid rgba(22, 160, 133, 0.05);
    transition: var(--keme-transition);
    position: relative;
}

.keme-card.interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--keme-shadow-hover);
    border-color: rgba(22, 160, 133, 0.15);
}

/* --- 4. SYSTEME DE BOUTONS (`keme-btn`) --- */
.keme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--keme-radius-full);
    border: none;
    cursor: pointer;
    transition: var(--keme-transition);
    text-decoration: none;
    outline: none;
}

.keme-btn-primary {
    background-color: var(--keme-primary);
    color: #ffffff;
}

.keme-btn-primary:hover {
    background-color: var(--keme-primary-hover);
}

.keme-btn-secondary {
    background-color: var(--keme-primary-light);
    color: var(--keme-primary);
    border: 1px solid rgba(22, 160, 133, 0.2);
}

.keme-btn-secondary:hover {
    background-color: rgba(22, 160, 133, 0.1);
}

.keme-btn-outline {
    background-color: transparent;
    color: var(--keme-gray-text);
    border: 1px solid var(--keme-border);
}

.keme-btn-outline:hover {
    background-color: var(--keme-light-gray);
    color: var(--keme-dark);
}

/* Bouton Spécial Micro / Enregistrement Vocal */
.keme-btn-record {
    background-color: var(--keme-danger);
    color: #ffffff;
    padding: 16px 32px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.keme-btn-record.pulse {
    animation: kemePulse 2s infinite ease-in-out;
}


/* --- 5. LISTES ET ELEMENTS DE DEFILEMENT (Dictionnaire / QCM) --- */
.keme-list-scrollable {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
    border: 1px solid var(--keme-border);
    border-radius: var(--keme-radius-md);
    background: #ffffff;
}

/* Design épuré de la scrollbar */
.keme-list-scrollable::-webkit-scrollbar {
    width: 6px;
}

.keme-list-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.keme-list-scrollable::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.keme-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--keme-border);
    transition: var(--keme-transition);
    cursor: pointer;
}

/*
.keme-list-item:last-child {
    border-bottom: none;
}
*/
.keme-list-item:hover {
    background-color: var(--keme-primary-light);
}

/* --- 6. FENÊTRES MODALES & DIALOGUES (Popups / Conversations) --- */
.keme-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(31, 41, 55, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: var(--keme-transition);
}

.keme-modal-content {
    background: #ffffff;
    border-radius: var(--keme-radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    animation: kemeModalSlide 0.3s ease-out;
}

/* --- ALPHABET EXTENSION (KEMELANG-UI) --- */

/* Conteneur de la grille d'alphabet */
.keme-alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

/* La tuile / carte d'un graphème */
.keme-grapheme-tile {
    cursor: pointer;
    background: #ffffff;
    border: 2px solid var(--keme-border);
    border-radius: var(--keme-radius-md);
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

/* Effet au survol */
.keme-grapheme-tile:hover {
    transform: translateY(-3px);
    border-color: var(--keme-secondary);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.05);
}

/* État actif : quand la lettre est en train d'être jouée */
.keme-grapheme-tile.keme-tile-playing {
    border-color: var(--keme-primary);
    background-color: rgba(22, 160, 133, 0.04);
    /* Teinte très subtile de ta couleur principale */
    transform: scale(0.98);
}

/* Typographie principale de la lettre */
.keme-grapheme-char {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--keme-dark);
    line-height: 1.1;
}

/* Affichage phonétique API en dessous */
.keme-grapheme-ipa {
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    color: var(--keme-secondary);
    margin-top: 4px;
}

/* Mini indicateur de type (Badge discret en haut à droite de la tuile) */
.keme-grapheme-type-tag {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--keme-gray-text);
    opacity: 0.6;
}


/* --- 7. ACCORDEONS (Leçons / Parchemins) --- */
.keme-accordion-item {
    border: 1px solid var(--keme-border);
    border-radius: var(--keme-radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    background: #ffffff;
}

.keme-accordion-trigger {
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    text-align: left;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--keme-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--keme-transition);
}

.keme-accordion-trigger:hover {
    background-color: var(--keme-light-gray);
}

.keme-accordion-panel {
    padding: 0 20px 16px 20px;
    color: var(--keme-gray-text);
    display: none;
    /* Déclenché par JS ou classe .open */
}

.keme-accordion-item.open .keme-accordion-panel {
    display: block;
}

/* --- 8. DROPDOWNS & FORM FIELDS --- */
.keme-dropdown-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.keme-select {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    font-family: var(--keme-font-sans);
    color: var(--keme-dark);
    background-color: #ffffff;
    border: 1.5px solid var(--keme-border);
    border-radius: var(--keme-radius-md);
    appearance: none;
    cursor: pointer;
    transition: var(--keme-transition);
    outline: none;
}

.keme-select:focus {
    border-color: var(--keme-primary);
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.1);
}

/* --- 9. BADGES & COMPOSANTS DE PROGRESSION --- */
.keme-badge {
    display: inline-flex;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--keme-radius-full);
}

.keme-badge-primary {
    background: var(--keme-primary-light);
    color: var(--keme-primary);
}

.keme-badge-success {
    background: #e8f8f0;
    color: var(--keme-success);
}

.keme-badge-danger {
    background: #fdeaea;
    color: var(--keme-danger);
}

.keme-progress-container {
    width: 100%;
    height: 8px;
    background-color: var(--keme-light-gray);
    border-radius: var(--keme-radius-full);
    overflow: hidden;
}

.keme-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--keme-primary), var(--keme-success));
    width: 0%;
    /* Piloté par le JS de l'arène */
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}



.btn-next-step {
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
}

.btn-next-step.success {
    background: #137333;
    color: white;
}

.btn-next-step.error {
    background: #c5221f;
    color: white !important;
}

/* --- COMPOSANTS DE L'INTERFACE EXERCICES --- */

.badge-delf {
    background-color: #0d9488;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
}

.instruction-box {
    margin-top: 10px;
    color: var(--keme-gray-text);
    font-style: italic;
    font-size: 1rem;
}

.kemelang-textarea {
    width: 100%;
    height: 180px;
    padding: 15px;
    border: 2px solid var(--keme-border);
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.kemelang-textarea:focus {
    outline: none;
    border-color: #0d9488;
}

/* --- COMPTEUR DE MOTS PREMIUM --- */

.counter-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.counter-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
}

.counter-badge.warning {
    background-color: #ffedd5;
    color: #ea580c;
}

.counter-badge.success {
    background-color: #dcfce7;
    color: #16a34a;
}

.counter-message {
    font-size: 0.9rem;
    color: var(--keme-gray-text);
}

.counter-message.success {
    color: #16a34a;
    font-weight: 500;
}

/* --- BARRE DE VALIDATION PREMIUME (FIXE EN BAS) --- */

/* Classes à ajouter dans kemelang-ui.css */

.premium-feedback-bar {
    position: fixed;
    bottom: -150px;
    left: 0;
    width: 100%;
    padding: 25px 20px;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    box-sizing: border-box;
}

.premium-feedback-bar.show {
    bottom: 0;
}

.feedback-success {
    background-color: #e6f4ea;
    border-top: 3px solid #137333;
}

.feedback-error {
    background-color: #fafafa;
    border-top: 3px solid #c5221f;
}


.feedback-container {
    max-width: 650px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}


.feedback-text-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.feedback-icon-success {
    background: #137333;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.feedback-title {
    margin: 0;
    color: #137333;
    font-size: 1.2rem;
    font-weight: 700;
}

.feedback-subtitle {
    margin: 3px 0 0 0;
    color: #1e4620;
    font-size: 0.95rem;
    font-weight: 500;
}

.btn-next-step {
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
}

.btn-next-step.success {
    background: #137333;
    color: white;
}

.btn-hidden {
    display: none;
}

/* --- PAGE D'ACCUEIL DELF INTRO --- */

.delf-intro-header {
    text-align: center;
    margin-bottom: 30px;
}

.badge-parchemin {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--keme-primary);
    border-bottom: 2px solid var(--keme-primary);
    padding-bottom: 4px;
    display: inline-block;
    margin-bottom: 10px;
}

.delf-main-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #111827;
    margin: 5px 0;
}

.delf-subtitle {
    font-size: 1.1rem;
    color: #4b5563;
    font-weight: 500;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.section-desc {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* --- TABLEAU DES ÉPREUVES --- */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 25px;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-bottom: 8px;
    /* Permet un scroll horizontal fluide si nécessaire */
    border: 1px solid #e5e7eb;
    /* Optionnel : encapsule proprement le tableau */
    border-radius: 8px;
}

.delf-summary-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.delf-summary-table th {
    background-color: #f3f4f6;
    color: #374151;
    padding: 12px 16px;
    font-weight: 700;
    border-bottom: 2px solid #e5e7eb;
}

.delf-summary-table td {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    color: #374151;
}

.table-subtext {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.text-center {
    text-align: center;
}

.font-bold {
    font-weight: 700;
}

/* --- ENCADRÉ DES RÈGLES --- */

.delf-rules-box {
    background-color: #f8fafc;
    border-left: 4px solid var(--keme-primary);
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 30px;
    text-align: left;
}

.rules-title {
    margin: 0 0 10px 0;
    color: var(--keme-primary);
    font-size: 1rem;
    font-weight: 700;
}

.delf-rules-box ul {
    margin: 0;
    padding-left: 20px;
    color: #334155;
    font-size: 0.95rem;
    text-align: left;
}

.delf-rules-box li {
    margin-bottom: 8px;
}

.delf-rules-box li:last-child {
    margin-bottom: 0;
}

.intro-action {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.text-center-link {
    text-decoration: none;
    display: inline-block;
}

/* --- NOUVEAUX COMPOSANTS DU RAPPORT D'EXAMEN --- */

.report-success {
    background-color: #e6f4ea !important;
    border-left: 6px solid #137333 !important;
    color: #137333;
}

.report-failed {
    background-color: #fce8e6 !important;
    border-left: 6px solid #c5221f !important;
    color: #c5221f;
}

.verdict-title {
    margin: 0 0 5px 0;
    font-size: 1.4rem;
    font-weight: 800;
}

.module-score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid var(--keme-border);
    border-radius: 12px;
    margin-bottom: 15px;
    background: #ffffff;
}

.module-score-row.eliminated-row {
    border-color: #fca5a5;
    background-color: #fff5f5;
}

.module-score-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: #1f2937;
}

.module-score-badge {
    font-size: 1rem;
    color: #4b5563;
    text-align: right;
    font-weight: 600;
}

.matching-radio-group {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(45px, 1fr));
    /* Force 6 colonnes égales pour A, B, C, D, E, F */
    gap: 10px;
    max-width: 400px;
    /* Évite que les boutons deviennent d'immenses rectangles sur grand écran */
    margin: 15px auto 0 auto;
    /* Centre le pavé de sélection */
}

.radio-tile {
    height: 45px;
    /* Aligne la hauteur sur la largeur minimale */
    padding: 0 !important;
    /* Laisse le flex centrer la lettre */
    min-width: 40px !important;
    /* Permet aux tuiles de respirer sur les petits téléphones */
    font-size: 1.1rem !important;
}

.score-number {
    font-size: 1.4rem;
    font-weight: 800;
    color: #111827;
}

.badge-sub-eliminated {
    display: block;
    font-size: 0.75rem;
    color: #c5221f;
    font-weight: bold;
    margin-top: 2px;
}

.text-danger {
    color: #c5221f;
    font-weight: 600;
}

/* --- 10. CLASSES UTILITAIRES --- */
.hidden {
    display: none !important;
}

.text-serif {
    font-family: var(--keme-font-serif);
}

.text-center {
    text-align: center;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   BANQUE D'IMAGES STICKY & QUESTIONS (EXERCICE 4)
   ========================================================================== */

/* Conteneur principal collant */
.sticky-image-bank {
    position: -webkit-sticky;
    position: sticky;
    top: 15px;
    z-index: 100;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.image-bank-title {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 0;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.image-bank-grid {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Tuiles individuelles d'images de la banque */
.global-option-tile {
    /*flex: 1;*/
    min-width: 100px;
    max-width: 30%;
    text-align: center;
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.global-option-tile img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 5px;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-item input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
    accent-color: #0d9488;
}

.global-option-id {
    font-weight: bold;
    color: #0d9488;
}

/* Blocs de questions */
.question-block {
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 1px dashed #e2e8f0;
}

.question-text-translation {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.question-text-native {
    color: #64748b;
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 20px;
    font-family: var(--keme-font-sans);

}

/* Input text classique */
.text-input-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.text-input-field:focus {
    border-color: #0d9488;
}

/* Boutons d'action */
.form-actions {
    margin-top: 30px;
    text-align: right;
}

.btn-submit {
    background: #0d9488;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: #0f766e;
}

/* Conteneur de la grille de boutons A B C D E F */
.matching-radio-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* On cache le bouton radio standard (le petit cercle) */
.radio-tile-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Le design de la tuile par défaut */
.radio-tile-box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-weight: bold;
    color: #0d9488;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 1.1rem;
}

/* Effet au survol (Desktop) */
.radio-tile-label:hover .radio-tile-box {
    border-color: #0d9488;
    background: #f0fdfa;
}

/* Style de la tuile quand elle est sélectionnée/cochée */
.radio-tile-input:checked+.radio-tile-box {
    background: #0d9488;
    border-color: #0d9488;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(13, 148, 136, 0.2);
}

/* ==========================================================================
   LECTEUR AUDIO PERSONNALISÉ KEMELANG (DELF CONDITIONS)
   ========================================================================== */

.kemelang-audio-player {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Bouton personnalisé */
.audio-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0d9488;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
    justify-content: center;
}

.audio-btn:hover:not(:disabled) {
    background: #0f766e;
    transform: translateY(-1px);
}

.audio-btn:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* Pause Mode State (Optionnel si tu veux autoriser la pause au sein d'une écoute) */
.audio-btn.pause-mode {
    background: #ea580c;
}

/* Container de progression */
.audio-status-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.audio-progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.audio-progress-fill {
    width: 0%;
    height: 100%;
    background: #0d9488;
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Métadonnées (Temps et compteur) */
.audio-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.audio-badge {
    background: #ccfbf1;
    color: #0f766e;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
}

.audio-badge.warning {
    background: #ffedd5;
    color: #c2410c;
}

.audio-badge.depleted {
    background: #fee2e2;
    color: #b91c1c;
}

.km-concept-group {
    background: #ffffff;
    border: 1px solid var(--km-border);
    border-radius: var(--km-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.km-concept-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.km-concept-badge {
    background: #e0f2fe;
    color: #0369a1;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.km-btn-delete-group {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.9rem;
}

.km-concept-meta-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.km-divider {
    border: 0;
    border-top: 1px dashed var(--km-border);
    margin: 1rem 0;
}

/* Translation Styles */
/* --- CONTAINER GLOBAL & EN-TÊTE --- */
.km-translation-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.km-translation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    /* Permet de passer à la ligne sur très petit écran */
}

.km-translation-header h2 {
    margin: 0;
    font-size: 1.75rem;
}

.km-lang-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

/* --- LE LAYOUT DES CARTES (DESKTOP PAR DÉFAUT) --- */
.km-translation-card {
    display: grid;
    grid-template-columns: 1.2fr 1fr 140px;
    /* 3 colonnes nettes : Source | Input | Bouton */
    gap: 1.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.km-source-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.km-phrase-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #1f2937;
    margin: 0;
    line-height: 1.5;
}

.km-context-badge {
    font-size: 0.8rem;
    background: #f3f4f6;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    color: #4b5563;
}

.km-textarea-inline {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    min-height: 44px;
}

.km-btn-save-translation {
    background: #047857;
    color: white;
    border: none;
    padding: 0.75rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    /* Prend toute la largeur de sa colonne d'ancrage */
    transition: background 0.2s ease;
}

.km-btn-save-translation:hover {
    background: #065f46;
}

.km-btn-save-translation:disabled {
    background: #9ca3af;
}

.km-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.flex-2 {
    flex: 2;
}

.flex-1 {
    flex: 1;
}


/* ==========================================================================
   EXTENSION DU DESIGN SYSTEM POUR LE MODULE DICTIONNAIRE
   ========================================================================== */

/* Alignement et ergonomie du bloc de recherche */
.keme-search-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.keme-search-label {
    font-weight: 600;
    color: var(--keme-gray-text);
    font-size: 0.95rem;
}

/* Encapsulation moderne input + bouton sans espace */
.keme-input-group {
    display: flex;
    width: 100%;
    background: #ffffff;
    border: 2px solid var(--keme-border);
    border-radius: var(--keme-radius-md);
    overflow: hidden;
    transition: var(--keme-transition);
}

.keme-input-group:focus-within {
    border-color: var(--keme-primary);
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.1);
}

.keme-search-input {
    flex: 1;
    border: none;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-family: var(--keme-font-sans);
    color: var(--keme-dark);
    outline: none;
    background: transparent;
}

.keme-input-group .keme-btn {
    border-radius: 0;
    /* Élimine l'arrondi pour fusionner avec l'input */
    padding: 0 30px;
    white-space: nowrap;
}

/* Zone des résultats dynamique */
.widget-results-container {
    margin-top: 25px;
    padding: 20px;
    background-color: var(--keme-light-gray);
    border-radius: var(--keme-radius-md);
    animation: fadeIn 0.3s ease;
}

.keme-results-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--keme-gray-text);
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--keme-border);
    padding-bottom: 5px;
}

/* Intégration esthétique de la factory JS (.translation-pair) */
.widget-results-content .translation-pair {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    padding: 12px 20px;
    border-radius: var(--keme-radius-sm);
    box-shadow: var(--keme-shadow-subtle);
    border: 1px solid var(--keme-border);
}

.widget-results-content .translation-arrow {
    color: var(--keme-primary);
    margin: 0 15px;
    font-weight: bold;
}

.widget-results-content .lang-mini-block {
    display: flex;
    flex-direction: column;
}

/* Ajustements pour le tableau natif du lexique */
.delf-summary-table tbody td {
    vertical-align: middle;
    /* Aligne le texte sur l'axe vertical avec le bouton */
}

/* ==========================================================================
   LAYOUT PRÉCIS DU DICTIONNAIRE (CORRECTION DES COLONNES)
   ========================================================================== */

/* Évite les conflits avec des conteneurs parents trop larges ou en flex horizontal */
.dict-page-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: block;
    /* Force l'empilement vertical strict des blocs */
}

/* Alignement de l'en-tête de page */
.dict-header {
    margin-bottom: 2.5rem;
    text-align: left;
}

.dict-subtitle {
    color: var(--keme-gray-text);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* WIDGET DE RECHERCHE */
.kemelang-translate-widget.keme-card {
    width: 100%;
    display: block;
    margin-bottom: 3.5rem;
    box-sizing: border-box;
}

.dict-search-label {
    display: block;
    font-weight: 600;
    color: var(--keme-dark);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* Barre de recherche unifiée et fusionnée */
.dict-input-group {
    display: flex;
    border: 1.5px solid var(--km-border);
    border-radius: var(--km-radius);
    overflow: hidden;
    background: #ffffff;
    transition: var(--km-transition);
}

.dict-input-group:focus-within {
    border-color: var(--keme-primary);
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.1);
}

.dict-search-input {
    flex: 1;
    border: none;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-family: var(--keme-font-sans);
    color: var(--keme-dark);
    outline: none;
}

.dict-input-group .widget-submit-btn {
    border-radius: 0 !important;
    /* Force la suppression de l'arrondi pour coller à l'input */
    padding: 0 32px;
    font-size: 1.05rem;
    white-space: nowrap;
}

/* SECTION DU LEXIQUE POPULAIRE */
.dict-lexicon-section {
    width: 100%;
    margin-top: 2rem;
}

.dict-section-title {
    color: var(--keme-dark);
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

/* Harmonisation des lignes du tableau */
.delf-summary-table tbody td {
    vertical-align: middle !important;
    padding: 18px 16px !important;
}

.dict-word-cell {
    font-size: 1.15rem;
    color: var(--km-primary);
}

.dict-def-cell {
    font-size: 1rem;
    color: var(--keme-gray-text);
}

/* Style compact pour les boutons du tableau */
.delf-summary-table .quick-translate.keme-btn-outline {
    padding: 8px 20px;
    font-size: 0.9rem;
    border-radius: var(--km-radius);
}

/* ==========================================================================
   OPTIMISATIONS RESPONSIVES MOBILES DE PRÉCISION
   ========================================================================== */

/* 1. Assurer que l'en-tête globale et ses enfants ne débordent jamais */
.dict-page-wrapper {
    overflow-x: hidden;
    /* Sécurité anti-scroll horizontal parasite */
}

/* 2. Empêcher le titre de la section lexique de déborder */
.dict-section-title {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    padding-right: 10px;
    font-size: 1.5rem;
    /* Légère réduction optionnelle pour mobile si besoin */
}

/* 3. Forcer la boîte responsive du tableau à bien scroller horizontalement en interne */
.table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    /* Défilement fluide au doigt sur iOS */
    margin-bottom: 1rem;
    display: block;
    /* Garantit le comportement de conteneur de bloc */
}

.delf-summary-table {
    min-width: 500px;
    /* Force le tableau à garder une largeur minimale lisible sous son scrollbar */
    width: 100%;
}


.widget-results-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.app-configurations-table,
table {
    table-layout: fixed;
    width: 100%;
}

/* Force les valeurs de configuration très longues (tokens, clés) à aller à la ligne */
td,
.configuration-value {
    word-break: break-all;
    white-space: normal;
}

/* ==========================================================================
   EXTENSION DICTIONNAIRE - DIALOGUE QUICK-VIEW & BADGES (kemelang-ui)
   ========================================================================== */

/* Cartes de résultats cliquables */
.word-card-quickview {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--keme-border);
    border-radius: var(--keme-radius-md);
    cursor: pointer;
    transition: var(--keme-transition);
}

.word-card-quickview:hover {
    border-color: var(--keme-primary);
    transform: translateY(-2px);
    box-shadow: var(--keme-shadow-subtle);
}


/* Badges révisés : compacts et sur une seule ligne */
.word-card-quickview .keme-badge {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}


/* Badges de Statut Morphologique */
.keme-badge-variant {
    background-color: #fef3c7;
    color: #b45309;
}

.keme-badge-canonical {
    background-color: var(--keme-primary-light);
    color: var(--keme-primary);
}

/* Modal Quick-View spécifique */
.keme-modal-content.quick-view {
    max-width: 520px;
    width: 95%;
}

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

.modal-body-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer-flex {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed var(--keme-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--keme-gray-text);
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--keme-danger);
}

.mutation-info-icon {
    cursor: help;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}

.mutation-info-icon:hover {
    color: var(--keme-primary);
}

/* Note pédagogique pour les formes mutées */
.mutation-note-box {
    background-color: var(--keme-primary-light);
    border-left: 3px solid var(--keme-primary);
    padding: 8px 12px;
    border-radius: 0 var(--keme-radius-sm) var(--keme-radius-sm) 0;
}

.badge-dot-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--keme-gray-text);
    font-weight: 500;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-variant {
    background-color: #d97706;
    /* Ambre / Muté */
    box-shadow: 0 0 0 3px #fef3c7;
}

.dot-standard {
    background-color: #0d9488;
    /* Émeraude / Standard */
    box-shadow: 0 0 0 3px #e6f4f1;
}

/* Fixe l'en-tête global en haut lors du scroll */
.km-bulk-header-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #ffffff;
    padding: 15px 20px;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.km-form-row-global {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.km-form-group {
    flex: 1;
}

.km-input-with-action {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Style du bouton clavier */
.keyboard-btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding: 8px 12px;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.keyboard-btn-inline:hover {
    background-color: #e2e8f0;
    border-color: #94a3b8;
}

/* Container global de la page d'ajout */
.km-bulk-form-container {
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: 60px;
}

/* En-tête Sticky Flottant (Glassmorphism moderne) */
.km-bulk-header-sticky {
    position: sticky;
    top: 15px;
    /* Décalé du haut pour un effet carte flottante */
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    margin-bottom: 28px;
    transition: all 0.3s ease;
}

/* Grille pour les champs principaux */
.km-form-row-global {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: end;
    margin-bottom: 16px;
}

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

.km-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Champ de texte et select au design moderne */
.km-input,
.km-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: #1e293b;
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.km-input:focus,
.km-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Zone d'action de la Langue Cible + Clavier */
.km-input-with-action {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Bouton Clavier Virtuel au look Tech / Matériel */
.keyboard-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.keyboard-btn-inline i {
    color: #2563eb;
    /* Icône bleue attirante */
    font-size: 1rem;
}

.keyboard-btn-inline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.keyboard-btn-inline:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Barre d'actions secondaires */
.km-bulk-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.km-actions-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Boutons generaux */
.km-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.km-btn-primary {
    background-color: var(--keme-primary);
    color: var(--keme-primary-light);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.km-btn-primary:hover {
    background-color: var(--keme-primary);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.km-btn-secondary {
    background-color: #f1f5f9;
    color: var(--primary-color);
    border: 1px solid #cbd5e1;
}

.km-btn-secondary:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.km-btn-link {
    background: transparent;
    color: #64748b;
}

.km-btn-link:hover {
    color: #ef4444;
}

/* Responsive Mobile */
@media (max-width: 640px) {
    .kemelang-audio-player {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .audio-btn {
        width: 100%;
    }
}


@keyframes kemePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(231, 76, 60, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

@keyframes kemeModalSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* --- 11. ADAPTATION RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .keme-card {
        padding: 20px 15px;
        border-radius: var(--keme-radius-md);
    }

    .keme-btn {
        width: 100%;
        /* Les boutons prennent toute la largeur sur mobile pour être "thumb-friendly" */
        padding: 14px 20px;
    }

    .keme-list-item {
        padding: 12px 15px;
    }

    .matching-radio-group {
        gap: 6px !important;
        /* Rapproche un chouïa les boutons */
    }

    .global-option-tile {
        max-width: 40%;
    }

    .sticky-image-bank {
        top: 5px !important;
        padding: 8px !important;
    }

    .sticky-image-bank .global-option-tile {
        /*min-width: 50px !important;
        max-width: 63px !important;*/
        padding: 4px !important;
    }

    .sticky-image-bank img {
        /*height: 35px !important;*/
        object-fit: cover;
    }

    /* La grille globale passe en une seule colonne */
    .km-meta-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    /* Chaque ligne de phrase se transforme en une carte verticale */
    .km-phrase-row {
        grid-template-columns: 1fr;
        /* Tout s'empile verticalement */
        gap: 1rem;
        padding: 1.25rem;
        position: relative;
        /* Pour positionner le bouton supprimer proprement */
    }

    /* Alignement complet des champs de saisie */
    .km-form-group-inline .km-input {
        width: 100%;
    }

    /* Conteneur pour regrouper les actions (Microphone + Supprimer) sur une ligne en bas de la carte */
    .km-phrase-row>div:nth-child(3) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-top: 1px solid #f1f5f9;
        padding-top: 0.75rem;
        margin-top: 0.25rem;
    }

    /* Modification du comportement du bouton supprimer sur mobile */
    .km-phrase-row .km-btn-delete {
        color: #ef4444;
        /* Plus visible sur mobile */
        padding: 0.5rem 1rem;
        background: #fef2f2;
        border-radius: 6px;
    }

    .km-phrase-row .km-btn-delete::after {
        content: " Supprimer";
        /* Ajoute du texte pour l'ergonomie mobile */
        font-family: 'Inter', sans-serif;
        font-size: 0.85rem;
        font-weight: 500;
    }

    /* Ajustement des boutons d'action généraux en bas de page */
    .km-actions-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .km-actions-footer .km-btn {
        width: 100%;
        justify-content: center;
    }

    .km-translation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .km-translation-card {
        display: flex;
        flex-direction: column;
        /* On empile tout verticalement */
        align-items: stretch;
        /* Les blocs prennent toute la largeur disponible */
        gap: 1rem;
        padding: 1.25rem;
    }

    .km-textarea-inline {
        min-height: 60px;
        /* Un peu plus d'espace pour écrire sur mobile */
    }

    .km-btn-save-translation {
        padding: 0.85rem;
        /* Bouton légèrement plus grand, plus facile à tapoter */
    }

    .keme-input-group {
        flex-direction: column;
        border: none;
        background: transparent;
        gap: 10px;
    }

    .keme-search-input {
        background: #ffffff;
        border: 2px solid var(--keme-border);
        border-radius: var(--keme-radius-md);
        width: 100%;
    }

    .keme-input-group .keme-btn {
        border-radius: var(--keme-radius-full);
        /* Reprend la forme pilule sur mobile */
        width: 100%;
        padding: 14px 20px;
    }

    .dict-page-wrapper {
        padding: 1rem 1rem;
        /* On donne un peu plus d'espace sur les bords sur mobile */
    }

    .dict-section-title {
        font-size: 1.35rem;
        /* Taille idéale pour que tout tienne proprement sur smartphone */
        line-height: 1.3;
    }
}