/* --- Base et Layout --- */
body {
    background-color: #0f0f0f;
    color: #e0e0e0;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

.main-wrapper {
    width: 90%;
    max-width: 1000px;
    text-align: center;
}

/* --- Menu de sélection --- */
.text-selector {
    margin-bottom: 30px;
}

#source-chooser {
    background: #1a1a1a;
    color: #4ade80;
    border: 1px solid #333;
    padding: 10px 20px;
    border-radius: 5px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

/* --- Statistiques --- */
.stats-header {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    background: #161616;
    padding: 15px;
    border-radius: 10px;
    border-bottom: 2px solid #222;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
}

.value {
    font-size: 1.8rem;
    color: #4ade80;
    font-weight: bold;
}

/* --- Zone de texte (Le cœur du jeu) --- */
#typing-area {
    position: relative;
    padding: 20px;
}

#text-display {
    font-size: 1.8rem;
    line-height: 1.6;
    text-align: left;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 15px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* --- États des Lettres --- */
.char {
    color: #d1d1d1; /* Lettres futures : Bien visibles */
    letter-spacing: 1px;
    transition: all 0.1s ease;
    border-bottom: 2px solid transparent;
}

/* La lettre active (le curseur) */
.char.current {
    color: #fff;
    background: rgba(74, 222, 128, 0.15);
    border-bottom: 2px solid #4ade80;
    animation: blinkCursor 0.8s infinite;
}

/* LETTRES DÉJÀ TAPÉES (GRISÉES) */
.char.typed {
    color: #353535 !important; /* Très sombre pour s'effacer */
    text-shadow: none;
}

/* Erreurs : on les laisse en rouge même si elles sont "typed" */
.char.wrong {
    color: #ff4d4d !important;
    background: rgba(255, 77, 77, 0.2);
}

.char.correct {
    /* Optionnel : petite lueur verte quand c'est juste mais passé */
}

/* --- Input caché --- */
#hidden-input {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

/* --- Écran de résultat --- */
.result-screen {
    background: #1a1a1a;
    padding: 40px;
    border-radius: 15px;
    border: 2px solid #4ade80;
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.1);
    animation: fadeIn 0.5s ease forwards;
}

.big-stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin: 30px 0;
}

.big-stats p {
    font-size: 2.5rem;
    color: #4ade80;
    margin: 0;
}

.btn-retry {
    background: #4ade80;
    color: #000;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-retry:hover {
    transform: scale(1.05);
}

/* --- Animations --- */
@keyframes blinkCursor {
    50% { border-color: transparent; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Overlay de démarrage --- */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}