* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #fff;
}

.container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #00d9ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 217, 255, 0.3);
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #00d9ff;
}

.high-score-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.high-score-bar span {
    background: rgba(255, 215, 0, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

#high-score, #high-wpm {
    color: #ffd700;
    font-weight: bold;
}

.game-area {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
}

.words-display {
    min-height: 80px;
    margin-bottom: 20px;
    line-height: 1.8;
    font-size: 1.5rem;
}

.word {
    display: inline;
}

.word.active {
    font-size: 2rem;
    margin-right: 15px;
}

.word.upcoming {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.3rem;
}

.word .correct {
    color: #00ff88;
}

.word .incorrect {
    color: #ff4757;
    text-decoration: underline;
}

.word .pending {
    color: rgba(255, 255, 255, 0.9);
}

.word-complete {
    animation: pop 0.2s ease;
}

.word-error {
    animation: shake 0.3s ease;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

#input-field {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.3rem;
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

#input-field:focus {
    border-color: #00d9ff;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

#input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#input-field::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.typed-indicator {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn.primary {
    background: linear-gradient(90deg, #00d9ff, #00ff88);
    color: #1a1a2e;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 217, 255, 0.4);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.settings {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.settings label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.settings select {
    padding: 8px 15px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    cursor: pointer;
    outline: none;
}

.settings select:focus {
    border-color: #00d9ff;
}

.settings select option {
    background: #1a1a2e;
    color: #fff;
}

.music-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.music-controls button {
    padding: 8px 15px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.music-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.song-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Game Over Modal */
.game-over-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    color: #00d9ff;
}

.final-stats {
    margin-bottom: 25px;
}

.final-stats p {
    font-size: 1.1rem;
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.9);
}

.final-stats span {
    font-weight: bold;
    color: #00ff88;
}

.new-record {
    font-size: 1.3rem;
    color: #ffd700;
    margin-top: 15px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .stats-bar {
        flex-wrap: wrap;
        gap: 15px;
    }

    .stat {
        flex: 1 1 40%;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .words-display {
        font-size: 1.2rem;
    }

    .word.active {
        font-size: 1.5rem;
    }

    .word.upcoming {
        font-size: 1.1rem;
    }

    #input-field {
        font-size: 1.1rem;
        padding: 12px 15px;
    }

    .high-score-bar {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .settings {
        flex-direction: column;
    }
}

/* Keyboard hint for Enter */
#input-field:not(:disabled):focus::after {
    content: 'Press Enter to start';
}
