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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    width: 100%;
    background: #111111;
    border-radius: 16px;
    border: 1px solid #222222;
    padding: 48px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.header {
    text-align: center;
    margin-bottom: 48px;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #888888;
    font-size: 1rem;
    font-weight: 400;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-card {
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #444444;
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 1.5rem;
    color: #666666;
    margin-bottom: 12px;
    display: block;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.progress-container {
    margin-bottom: 32px;
}

.progress-bar {
    height: 4px;
    background: #222222;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: #ffffff;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.875rem;
    color: #666666;
    text-align: center;
}

.text-container {
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 32px;
    font-size: 1.25rem;
    line-height: 1.8;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    position: relative;
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    display: block;
}

.text-content {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    /* transition: transform 0.3s ease; */
}

.word {
    display: inline-flex;
    padding: 2px 4px;
    border-radius: 4px;
}

.word.current {
    background: rgba(255, 255, 255, 0.05);
}

.word.correct {
    /* color: #22c55e; */
}

.word.incorrect {
    /* color: #ef4444; */
}

.letter {
    color: #666666;
    position: relative;
}

.letter.correct {
    color: #ffffff;
}

.letter.incorrect {
    color: #ef4444;
}

.letter.current {
    /* color: #ffffff; */
}

#cursor {
    position: absolute;
    width: 2px;
    background: #ffffff;
    transition: all 0.1s ease;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.input-section {
    margin-bottom: 32px;
}

.typing-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.125rem;
    background: #1a1a1a;
    border: 2px solid #333333;
    border-radius: 12px;
    color: #ffffff;
    outline: none;
    transition: all 0.2s ease;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.typing-input:focus {
    border-color: #ffffff;
}

.typing-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
}

.btn-primary {
    background: #ffffff;
    color: #000000;
}

.btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: #ffffff;
    border: 1px solid #333333;
}

.btn-secondary:hover {
    border-color: #666666;
    transform: translateY(-1px);
}

.timer {
    position: fixed;
    top: 32px;
    right: 32px;
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}

.results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.results-modal.active {
    opacity: 1;
    visibility: visible;
}

.results-content {
    background: #111111;
    border: 1px solid #333333;
    border-radius: 16px;
    padding: 48px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.results-modal.active .results-content {
    transform: scale(1);
}

.results-message {
    color: #888888;
    font-size: 1.125rem;
    margin-bottom: 32px;
    line-height: 1.5;
}

.results-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: #ffffff;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.results-stat {
    text-align: center;
}

.results-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.results-stat-label {
    font-size: 0.875rem;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    .container {
        padding: 32px 24px;
        margin: 16px;
    }

    .title {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .text-container {
        padding: 24px;
        font-size: 1rem;
    }

    .typing-input {
        font-size: 1rem;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }

    .timer {
        position: static;
        width: fit-content;
        margin: 0 auto 24px;
    }

    .results-content {
        padding: 32px 24px;
    }

    .results-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.hidden {
    display: none;
}