:root {
    --primary: #6200ee;
    --primary-light: #9e47ff;
    --primary-dark: #0400ba;
    --secondary: #03dac6;
    --background: #121212;
    --surface: #1e1e1e;
    --error: #cf6679;
    --on-primary: #ffffff;
    --on-secondary: #000000;
    --on-background: #ffffff;
    --on-surface: #ffffff;
    --on-error: #000000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--on-background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    font-size: 2.5rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.3rem;
}

.info-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary);
}

.typing-area {
    margin-bottom: 2rem;
    position: relative;
}

.target-text {
    font-size: 1.5rem;
    line-height: 2rem;
    margin-bottom: 1rem;
    min-height: 100px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    white-space: pre-wrap;
}

.input-area {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--primary);
    border-radius: 8px;
    color: white;
    outline: none;
    transition: all 0.3s ease;
}

.input-area:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(3, 218, 198, 0.3);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.start-btn {
    background-color: var(--primary);
    color: var(--on-primary);
}

.start-btn:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(98, 0, 238, 0.3);
}

.reset-btn {
    background-color: transparent;
    color: var(--secondary);
    border: 2px solid var(--secondary);
}

.reset-btn:hover {
    background-color: rgba(3, 218, 198, 0.1);
    transform: translateY(-2px);
}

.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.result-modal.active {
    opacity: 1;
    pointer-events: all;
}

.result-content {
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.result-modal.active .result-content {
    transform: translateY(0);
}

.result-title {
    color: var(--secondary);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.result-stat {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
}

.result-stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--secondary);
    margin-bottom: 0.3rem;
}

.result-stat-label {
    font-size: 0.9rem;
    opacity: 0.7;
}

.close-btn {
    background-color: var(--primary);
    color: var(--on-primary);
    width: 100%;
    margin-top: 1rem;
}

.close-btn:hover {
    background-color: var(--primary-light);
}

.progress-bar {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: var(--secondary);
    width: 0%;
    transition: width 0.3s ease;
}

.character {
    position: relative;
    display: inline-block;
}

.character.correct {
    color: var(--secondary);
}

.character.incorrect {
    color: var(--error);
    text-decoration: underline;
}

.character.current {
    background-color: rgba(3, 218, 198, 0.2);
    border-radius: 2px;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    border-radius: 50%;
    pointer-events: none;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.difficulty-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn.active {
    background-color: var(--primary);
    color: white;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--on-surface);
    font-size: 1.5rem;
    cursor: pointer;
}

.quote-info {
    font-size: 0.8rem;
    opacity: 0.7;
    text-align: right;
    margin-top: 0.5rem;
    font-style: italic;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .target-text {
        font-size: 1.2rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 1rem;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
}