* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Light Theme (default) */
body[data-theme="light"] {
    background: linear-gradient(135deg, #258f48 0%, #a9a1b0 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: all 0.3s ease;
}

body[data-theme="dark"] {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: all 0.3s ease;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 900px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

body[data-theme="dark"] .container {
    background: #1e1e2e;
    color: #e0e0e0;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

h1 {
    text-align: center;
    color: #333;
    font-size: 2rem;
    margin: 0;
}

body[data-theme="dark"] h1 {
    color: #e0e0e0;
}

.theme-btn {
    background: #15b7a6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.theme-btn:hover {
    transform: scale(1.05);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(135deg, #7b3c3c 0%, #c0652c 100%);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    color: white;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-unit {
    font-size: 0.75rem;
    margin-left: 2px;
}

.text-display {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

body[data-theme="dark"] .text-display {
    background: #2a2a3e;
    border-color: #3a3a4e;
}

#sample-text {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #333;
    word-break: break-word;
    font-family: 'Courier New', monospace;
}

body[data-theme="dark"] #sample-text {
    color: #e0e0e0;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    resize: none;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

body[data-theme="dark"] textarea {
    background: #2a2a3e;
    color: #e0e0e0;
    border-color: #3a3a4e;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-twitter {
    background: #1DA1F2;
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.leaderboard {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    transition: all 0.3s ease;
}

body[data-theme="dark"] .leaderboard {
    background: #2a2a3e;
}

.leaderboard h3 {
    margin-bottom: 15px;
    color: #333;
}

body[data-theme="dark"] .leaderboard h3 {
    color: #e0e0e0;
}

#leaderboard-list {
    max-height: 200px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

body[data-theme="dark"] .leaderboard-item {
    border-bottom-color: #3a3a4e;
}

.leaderboard-rank {
    font-weight: bold;
    color: #667eea;
}

.leaderboard-name {
    flex: 1;
    margin-left: 10px;
}

.leaderboard-score {
    font-weight: bold;
}

.btn-small {
    margin-top: 10px;
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-small:hover {
    background: #c82333;
}

.result {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: #e8f5e9;
    border-radius: 12px;
}

body[data-theme="dark"] .result {
    background: #1e3a2e;
}

.result h2 {
    color: #2e7d32;
    margin-bottom: 15px;
}

body[data-theme="dark"] .result h2 {
    color: #4caf50;
}

.result p {
    font-size: 1.2rem;
    margin: 10px 0;
}

.result-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

#final-wpm, #final-accuracy, #final-errors {
    font-size: 1.5rem;
    color: #667eea;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .btn {
        padding: 8px 20px;
    }

    .result-buttons {
        flex-direction: column;
    }
}

/* Time Options */
.time-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.time-label {
    font-weight: bold;
    color: #666;
}

body[data-theme="dark"] .time-label {
    color: #aaa;
}

.time-btn {
    padding: 6px 15px;
    background: #e0e0e0;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.time-btn:hover {
    background: #667eea;
    color: white;
}

.time-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body[data-theme="dark"] .time-btn {
    background: #3a3a4e;
    color: #e0e0e0;
}

body[data-theme="dark"] .time-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Mode Options */
.mode-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 8px 20px;
    background: #e0e0e0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: #667eea;
    color: white;
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body[data-theme="dark"] .mode-btn {
    background: #3a3a4e;
    color: #e0e0e0;
}

/* Word Info */
.word-info {
    background: #fff3e0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #ff9800;
}

body[data-theme="dark"] .word-info {
    background: #2a2a3e;
    border-left-color: #ff9800;
}

.word-info h3 {
    color: #ff9800;
    margin-bottom: 10px;
}

.word-info p {
    margin: 5px 0;
    color: #555;
}

body[data-theme="dark"] .word-info p {
    color: #ccc;
}
