/* Styles spécifiques pour la page de test de vitesse de frappe (inspirés de votre exemple) */
.typing-test-wrapper {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 2.5rem;
    margin: 0 auto;
    max-width: 900px; /* On limite la largeur pour la lisibilité */
}

@keyframes slideInErgo {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

.typing-test-wrapper > h1 {
    display: none;
}

.typing-test-wrapper h1 {
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.8em; /* Plus grand */
    margin-bottom: 35px; /* Plus d'espace */
    font-weight: 700; /* Un peu moins que 800 pour la police du site */
    text-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.typing-test-wrapper .menu {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.typing-test-wrapper .section-title {
    font-size: 1.3em; /* Ajusté */
    font-weight: 600;
    color: #3a3a3a; /* Un gris plus foncé */
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.typing-test-wrapper .cards-container {
    display: grid;
    gap: 18px; /* Espace entre les cartes */
}

.typing-test-wrapper .mode-cards {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* Ajusté pour 2 modes */
}

.typing-test-wrapper .level-cards {
    /* 4 colonnes sur desktop, s'adapte ensuite */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
     /* Pourrait être repeat(4, 1fr) sur desktop et s'adapter ensuite avec media queries */
}

.typing-test-wrapper .card {
    background: linear-gradient(145deg, #f9faff 0%, #eef2f7 100%); /* Fond carte */
    border: 2px solid transparent; /* Bordure initiale transparente */
    border-radius: 14px; /* Moins que le wrapper */
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.typing-test-wrapper .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.18);
    border-color: rgba(102, 126, 234, 0.25);
}

.typing-test-wrapper .card.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #5a67d8; /* Ou une couleur du gradient */
    transform: translateY(-3px) scale(1.02); /* Léger agrandissement */
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.25);
}
.typing-test-wrapper .card.selected .card-title,
.typing-test-wrapper .card.selected .card-description,
.typing-test-wrapper .card.selected .card-icon {
    color: white; /* Assurer que le texte devient blanc */
    opacity: 1;
}
 .typing-test-wrapper .card.selected .card-description {
    opacity: 0.9; /* Légère transparence pour la description */
}


.typing-test-wrapper .card-icon {
    font-size: 2.2em; /* Ajusté */
    margin-bottom: 12px;
    text-align: center;
    display: block;
    color: #667eea; /* Couleur par défaut pour les icônes */
}

.typing-test-wrapper .card-title {
    font-size: 1.15em; /* Ajusté */
    font-weight: 600; /* Un peu moins que 700 */
    margin-bottom: 8px;
    text-align: center;
    color: #333;
}

.typing-test-wrapper .card-description {
    font-size: 0.9em; /* Ajusté */
    opacity: 0.7;
    text-align: center;
    line-height: 1.35;
    color: #555;
}

/* Spécificités pour les cartes de niveau (plus petites) */
.typing-test-wrapper .level-card {
    padding: 15px; /* Moins de padding */
}
.typing-test-wrapper .level-card .card-icon {
    font-size: 1.6em;
    margin-bottom: 8px;
}
.typing-test-wrapper .level-card .card-title {
    font-size: 1em;
    margin-bottom: 4px;
}
.typing-test-wrapper .level-card .card-description {
    font-size: 0.8em;
}

.typing-test-wrapper .start-btn {
    width: 100%;
    padding: 18px; /* Un peu moins */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px; /* Cohérent avec les cartes */
    font-size: 1.2em; /* Ajusté */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
}
.typing-test-wrapper .start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.35);
}
.typing-test-wrapper .start-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.2);
}


/* Styles pour la zone de test et résultats (repris de votre exemple précédent avec adaptations) */
.typing-test-wrapper .test-area { display: none; animation: fadeInErgo 0.6s ease-in; }
@keyframes fadeInErgo { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
.typing-test-wrapper .test-content { display: flex; flex-direction: column; gap: 20px; }
.typing-test-wrapper .test-content.side-by-side { flex-direction: row; gap: 25px; align-items: stretch; }
.typing-test-wrapper .phrase-text { background: #f0f3f9; border: 1px solid #d1d9e6; border-radius: 12px; padding: 20px; font-size: 1.15em; line-height: 1.7; color: #333; text-align: center; margin-bottom: 20px; white-space: pre-wrap; box-shadow: 0 5px 15px rgba(0,0,0,0.06); }
.typing-test-wrapper .text-panel { flex: 1; background: #f0f3f9; border: 1px solid #d1d9e6; border-radius: 12px; padding: 20px; font-size: 1.1em; line-height: 1.7; color: #333; height: 380px; overflow-y: auto; white-space: pre-wrap; box-shadow: 0 5px 15px rgba(0,0,0,0.06); }
.typing-test-wrapper .input-panel { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.typing-test-wrapper .stats-container { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.typing-test-wrapper .timer { text-align: center; font-size: 2em; font-weight: 700; background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; padding: 15px; background-color: rgba(102, 126, 234, 0.08); border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.06); }
.typing-test-wrapper textarea { width: 100%; min-height: 160px; padding: 18px; border: 2px solid #d1d9e6; border-radius: 12px; font-size: 15px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; resize: none; transition: all 0.25s ease; line-height: 1.7; background: #fdfdff; box-shadow: 0 5px 15px rgba(0,0,0,0.06); }
.typing-test-wrapper textarea.text-mode-height { height: 380px; }
.typing-test-wrapper textarea.phrase-mode-height { height: 130px; }
.typing-test-wrapper textarea:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); }
.typing-test-wrapper .progress-info { display: flex; justify-content: space-between; align-items: center; background: #e9edff; padding: 10px 15px; border-radius: 8px; font-weight: 600; color: #555; box-shadow: 0 3px 10px rgba(0,0,0,0.04); font-size: 0.9em;}
.typing-test-wrapper .progress-bar-container { width: 100%; height: 10px; background: #d0d8f0; border-radius: 5px; overflow: hidden; margin: 10px 0; box-shadow: inset 0 1px 3px rgba(0,0,0,0.08); }
.typing-test-wrapper .progress-bar { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); width: 0%; transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 5px; }
.typing-test-wrapper .char { position: relative; transition: all 0.15s ease; padding: 0 1px; } /* Léger padding pour le fond */
.typing-test-wrapper .char.correct { background-color: #c3e6cb; color: #1B4D3E; border-radius: 3px; }
.typing-test-wrapper .char.incorrect { background-color: #f5c6cb; color: #721c24; border-radius: 3px; text-decoration: underline wavy red; }
.typing-test-wrapper .char.current { background-color: #667eea; color: white; animation: blinkErgo 1.1s infinite; border-radius: 3px; }
@keyframes blinkErgo { 0%, 49% { background-color: #667eea; color: white; } 50%, 100% { background-color: transparent; color: inherit; } }
.typing-test-wrapper .results { display: none; text-align: center; padding: 30px; background: linear-gradient(135deg, #e9f7f5 0%, #fdecef 100%); border-radius: 18px; margin-top: 25px; animation: bounceInErgo 0.7s ease-out; box-shadow: 0 12px 30px rgba(0,0,0,0.1); }
@keyframes bounceInErgo { 0% { opacity: 0; transform: scale(0.5); } 50% { opacity: 1; transform: scale(1.03); } 70% { transform: scale(0.97); } 100% { opacity: 1; transform: scale(1); } }
.typing-test-wrapper .results h2 { background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-size: 2em; margin-bottom: 18px; font-weight: 700; }
.typing-test-wrapper .speed-display { font-size: 3em; font-weight: 800; background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin: 20px 0; }
.typing-test-wrapper .level-info { font-size: 1.15em; margin: 18px 0; padding: 18px; background: rgba(255,255,255,0.85); border-radius: 10px; font-weight: 600; color: #444; }
.typing-test-wrapper .message { font-size: 1.35em; font-weight: 600; margin: 20px 0; padding: 18px; border-radius: 10px; }
.typing-test-wrapper .message.above { background: linear-gradient(135deg, #d4edda, #c3e6cb); color: #1B4D3E; }
.typing-test-wrapper .message.equal { background: linear-gradient(135deg, #fff3cd, #ffeeba); color: #856404; }
.typing-test-wrapper .message.below { background: linear-gradient(135deg, #f8d7da, #f5c6cb); color: #721c24; }
.typing-test-wrapper .menu-btn-style { padding: 12px 25px; background: linear-gradient(135deg, #54a0ff 0%, #2e86de 100%); color: white; border: none; border-radius: 10px; font-size: 1.05em; font-weight: 600; cursor: pointer; transition: all 0.25s ease; margin-top: 18px; }
.typing-test-wrapper .menu-btn-style:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(84, 160, 255, 0.25); }
.typing-test-wrapper .hidden { display: none !important; }

.results-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}
.result-card {
    background: rgba(255,255,255,0.7);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}
.result-card-label {
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
    display: block;
}
.result-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--admin-primary-color);
}
.result-card-value.good { color: #28a745; }
.result-card-value.bad { color: #dc3545; }

/* Responsive adjustments */
@media (max-width: 992px) { /* Tablettes */
    .typing-test-wrapper .level-cards {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}
@media (max-width: 768px) {
    .typing-test-wrapper { padding: 20px; margin-top: 20px; }
    .typing-test-wrapper h1 { font-size: 2em; }
    .typing-test-wrapper .mode-cards { grid-template-columns: 1fr; } /* Une carte mode par ligne */
    .typing-test-wrapper .level-cards { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
    .typing-test-wrapper .test-content.side-by-side { flex-direction: column; gap: 18px;}
    .typing-test-wrapper .speed-display { font-size: 2.5em; }
    .typing-test-wrapper .text-panel { height: 260px; font-size: 1em;}
    .typing-test-wrapper textarea.text-mode-height { height: 260px; }
    .typing-test-wrapper textarea.phrase-mode-height { height: 110px; }
}
 @media (max-width: 480px) {
    .typing-test-wrapper { padding: 15px;}
    .typing-test-wrapper h1 { font-size: 1.7em; margin-bottom: 25px;}
    .typing-test-wrapper .section-title { font-size: 1.1em; margin-bottom: 12px; }
    .typing-test-wrapper .card { padding: 15px; }
    .typing-test-wrapper .card-icon { font-size: 1.8em; margin-bottom: 10px;}
    .typing-test-wrapper .card-title { font-size: 1em;}
    .typing-test-wrapper .card-description { font-size: 0.8em;}
    .typing-test-wrapper .level-cards { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
    .typing-test-wrapper .level-card .card-icon { font-size: 1.4em;}
    .typing-test-wrapper .level-card .card-title { font-size: 0.9em;}
    .typing-test-wrapper .level-card .card-description { font-size: 0.75em;}
    .typing-test-wrapper .start-btn { font-size: 1.1em; padding: 15px; }
    .typing-test-wrapper .phrase-text { font-size: 0.95em; padding: 15px;}
    .typing-test-wrapper .text-panel { font-size: 0.9em; padding: 15px; height: 200px;}
    .typing-test-wrapper .timer { font-size: 1.6em; padding: 10px;}
    .typing-test-wrapper textarea { font-size: 13px; padding: 12px;}
    .typing-test-wrapper textarea.text-mode-height { height: 200px; }
    .typing-test-wrapper textarea.phrase-mode-height { height: 90px; }
    .typing-test-wrapper .results h2 { font-size: 1.6em; }
    .typing-test-wrapper .speed-display { font-size: 2.2em; }
    .typing-test-wrapper .level-info { font-size: 0.95em; padding: 15px; }
    .typing-test-wrapper .message { font-size: 1.1em; padding: 15px; }
    .typing-test-wrapper .menu-btn-style { font-size: 1em; padding: 12px 20px; }
}