:root {
    --bg: #f0f4f8;
    --card: #ffffff;
    --primary: #6c5ce7;
    --secondary: #00cec9;
    --error: #ff7675;
    --success: #55efc4;
    --text: #2d3436;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.game-card {
    background: var(--card);
    width: 90%;
    max-width: 900px;
    padding: 30px;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    text-align: center;
}

h1 { font-family: 'Fredoka One', cursive; color: var(--primary); font-size: 2.5rem; margin: 0; }

.setup-section {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.control-group { display: flex; flex-direction: column; align-items: flex-start; }

select, button {
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid #eee;
    font-size: 1rem;
    outline: none;
}

button {
    background: var(--primary);
    color: white;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: 0.3s;
    margin-top: auto;
}

button:hover { background: #5849d1; transform: translateY(-2px); }

.stats-bar {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.stat { font-weight: 600; font-size: 1.2rem; color: var(--primary); }

.display-area {
    text-align: left;
    font-size: 1.3rem;
    line-height: 1.8;
    height: 150px;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
    border: 2px solid #f1f1f1;
    border-radius: 15px;
    margin-bottom: 20px;
    user-select: none;
}

/* Estilos para las palabras dinámicas */
.word { display: inline-block; margin-right: 10px; color: #b2bec3; transition: 0.2s; }
.word.active { background: #e8e6ff; border-radius: 5px; color: var(--text); }
.word.correct { color: var(--success); font-weight: 600; }
.word.incorrect { color: var(--error); text-decoration: underline; font-weight: 600; }

textarea {
    width: 100%;
    height: 80px;
    padding: 15px;
    border-radius: 15px;
    border: 3px solid #eee;
    font-size: 1.2rem;
    resize: none;
    box-sizing: border-box;
}

textarea:focus { border-color: var(--secondary); outline: none; }

/* Modal */
.overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center;
}

.modal {
    background: white; padding: 40px; border-radius: 25px; max-width: 400px; width: 80%;
}

.result-circle {
    width: 120px; height: 120px; border: 8px solid var(--secondary);
    border-radius: 50%; margin: 20px auto; display: flex;
    flex-direction: column; justify-content: center;
}

#final-wpm { font-size: 2.5rem; font-weight: bold; color: var(--primary); }