/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}

body.dark {
    background-color: #1e1e1e;
    color: #f5f5f5;
}

/* App Container */
.app-container {
    max-width: 700px;
    width: 100%;
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: background 0.3s, color 0.3s;
}

body.dark .app-container {
    background-color: #2b2b2b;
}

/* Header */
.app-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.app-description {
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
}

body.dark .app-description {
    color: #ccc;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.control-item {
    margin-bottom: 10px;
}

select, button {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

select:focus, button:focus {
    outline: none;
    border-color: #5ebed8;
}

button:hover {
    background-color: #24a475;
    color: white;
}

body.dark select, body.dark button {
    border-color: #555;
}

body.dark button:hover {
    background-color: #2da39e;
}

/* Typing Area */
.typing-area {
    margin-bottom: 25px;
}

.text-display {
    font-size: 1.2rem;
    line-height: 1.6;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-height: 60px;
    margin-bottom: 15px;
    transition: border 0.3s, background 0.3s, color 0.3s;
}

body.dark .text-display {
    border-color: #555;
}

.input-box {
    width: 100%;
    height: 120px;
    padding: 12px;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    resize: none;
    transition: border 0.3s, background 0.3s, color 0.3s;
}

body.dark .input-box {
    background-color: #333;
    color: #f5f5f5;
    border-color: #555;
}

/* Stats */
.stats {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stat-item {
    background-color: #f0f0f0;
    flex: 1;
    margin: 5px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    transition: background 0.3s, transform 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stat-item:hover {
    transform: translateY(-3px);
    background-color: #e0e0e0;
}

body.dark .stat-item {
    background-color: #3a3a3a;
}

body.dark .stat-item:hover {
    background-color: #4a4a4a;
}

.stat-label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

/* Actions */
.actions {
    text-align: center;
    margin-bottom: 25px;
}

.actions button {
    padding: 10px 25px;
    font-size: 1rem;
}

/* History */
.history {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: background 0.3s;
}

body.dark .history {
    background-color: #3a3a3a;
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #777;
}

body.dark .app-footer {
    color: #bbb;
}

/* Correct / Incorrect letters */
.correct {
    color: rgb(13, 176, 201);
}

.incorrect {
    color: red;
}

/* Responsive */
@media (max-width: 600px) {
    .stats {
        flex-direction: column;
    }

    .stat-item {
        margin: 8px 0;
    }

    .controls {
        flex-direction: column;
    }

    .control-item {
        margin-bottom: 10px;
    }
}
