* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #333;
}

.container {
    width: 90%;
    max-width: 800px;
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    text-align: center;
    color: #333;
}

h1 {
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
}

h2 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

/* Settings section */
.settings {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    width: 48%;
}

label {
    margin-bottom: 0.5rem;
    font-weight: bold;
}

select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
}

/* Custom dropdown styles */
.dropdown-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-dropdown {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.dropdown-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #666;
}

/* Dark mode dropdown */
body.dark-mode .custom-dropdown {
    background-color: #333;
    color: #f0f0f0;
    border-color: #555;
}

body.dark-mode .dropdown-arrow {
    color: #aaa;
}

/* Slider styles */
.slider-container {
    width: 100%;
    margin-top: 10px;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;  
    background: #d3d3d3;
    outline: none;
    -webkit-transition: .2s;
    transition: opacity .2s;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%; 
    background: #4CAF50;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.8rem;
    color: #666;
}

/* Dark mode slider */
body.dark-mode .slider {
    background: #555;
}

body.dark-mode .slider::-webkit-slider-thumb {
    background: #4CAF50;
}

body.dark-mode .slider::-moz-range-thumb {
    background: #4CAF50;
}

body.dark-mode .slider-labels {
    color: #aaa;
}

/* Test info */
.test-info {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 0.8rem;
    background-color: #e6f7ff;
    border-radius: 5px;
    font-weight: bold;
}

/* Test container */
.test-container {
    margin-bottom: 2rem;
}

.test-text {
    background-color: #f9f9f9;
    padding: 1.2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    line-height: 1.6;
    min-height: 120px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-area {
    width: 100%;
    height: 150px;
    padding: 1.2rem;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    resize: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-area:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.input-area:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Stats section */
.stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin-bottom: 2rem;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
}

.stat {
    text-align: center;
    font-size: 1.1rem;
    margin: 0.5rem;
    min-width: 120px;
}

.stat span:last-child {
    font-weight: bold;
    color: #4CAF50;
}

/* Buttons */
.buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

button {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Results section */
.results {
    background-color: #f0f7f0;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #4CAF50;
}

.result-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
}

.result-stat {
    font-size: 1.2rem;
    font-weight: bold;
}

.hidden {
    display: none;
}

/* Character styling */
.correct {
    color: #4CAF50;
}

.incorrect {
    color: #f44336;
    text-decoration: underline;
    background-color: rgba(244, 67, 54, 0.1);
}

.current {
    background-color: #e6f7ff;
    border-bottom: 2px solid #2196F3;
}

/* Keyboard visualization */
.keyboard-section {
    margin-top: 2rem;
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.keyboard-section h3 {
    margin-bottom: 1rem;
    text-align: center;
    color: #333;
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
}

.key {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    text-transform: lowercase;
    user-select: none;
}

.space-key {
    width: 300px;
    font-size: 0.8rem;
}

.key-pressed {
    background-color: #4CAF50;
    color: white;
    transform: translateY(2px);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

.key-history-container {
    margin-top: 1rem;
}

.key-history-container h4 {
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 1rem;
    color: #555;
}

.key-history {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
    background-color: white;
    padding: 0.8rem;
    border-radius: 5px;
    border: 1px solid #ddd;
    min-height: 40px;
}

.history-key {
    display: inline-block;
    width: 25px;
    height: 25px;
    line-height: 25px;
    text-align: center;
    background-color: #f0f0f0;
    border-radius: 3px;
    font-size: 0.8rem;
    margin: 0.1rem;
}

.space-history {
    width: 40px;
    background-color: #e0e0e0;
}

/* Toggle switch for keyboard visibility */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-switch label:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + label {
    background-color: #4CAF50;
}

.toggle-switch input:checked + label:before {
    transform: translateX(26px);
}

/* Progress bar */
.progress-container {
    width: 100%;
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #4CAF50;
    width: 0%;
    transition: width 0.3s;
}

/* Tips section */
.tips {
    margin-top: 2rem;
    background-color: #f0f7f0;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.tips h3 {
    margin-bottom: 1rem;
    color: #333;
}

.tips ul {
    padding-left: 1.5rem;
}

.tips li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: #666;
    font-size: 0.9rem;
}

footer a {
    color: #4CAF50;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Result message */
.result-message {
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #4CAF50;
}

/* Dark mode */
body.dark-mode {
    background-color: #222;
    color: #f0f0f0;
}

body.dark-mode .container {
    background-color: #333;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 {
    color: #f0f0f0;
}

body.dark-mode .settings,
body.dark-mode .test-text,
body.dark-mode .stats,
body.dark-mode .keyboard-section,
body.dark-mode .tips {
    background-color: #444;
    border-color: #555;
}

body.dark-mode .test-info {
    background-color: #2c3e50;
}

body.dark-mode .input-area {
    background-color: #444;
    color: #f0f0f0;
    border-color: #555;
}

body.dark-mode .input-area:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

body.dark-mode .key,
body.dark-mode .key-history {
    background-color: #555;
    color: #f0f0f0;
    border-color: #666;
}

body.dark-mode .history-key {
    background-color: #444;
    color: #f0f0f0;
}

body.dark-mode .space-history {
    background-color: #333;
}

body.dark-mode .results {
    background-color: #2c3e50;
    border-color: #4CAF50;
}

body.dark-mode footer {
    color: #aaa;
}

body.dark-mode footer a {
    color: #7fba7f;
}

/* Responsive design */
@media (max-width: 768px) {
    .settings {
        flex-direction: column;
    }
    
    .setting-group {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .stats {
        flex-wrap: wrap;
    }
    
    .stat {
        width: 45%;
        margin-bottom: 1rem;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .result-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .key {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .space-key {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
        width: 95%;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .test-text, .input-area {
        font-size: 1rem;
    }
    
    .key {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }
    
    .space-key {
        width: 100px;
    }
}
