body {
    font-family: 'Courier New', monospace;
    background-color: #1e1e1e;
    color: #d4d4d4;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

#stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.text-display {
    font-size: 1.5em;
    margin: 20px 0;
    padding: 20px;
    background-color: #2d2d2d;
    border-radius: 5px;
    line-height: 1.5;
}

#typing-input {
    width: 80%;
    padding: 10px;
    font-size: 1.2em;
    background-color: #3d3d3d;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    margin-bottom: 20px;
}

#restart-btn,
#retry-btn,
#start-custom-test,
#start-timed-test,
#start-untimed-test,
#start-challenge {
    padding: 10px 20px;
    font-size: 1.1em;
    background-color: #0078d4;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#restart-btn:hover,
#retry-btn:hover,
#start-custom-test:hover,
#start-timed-test:hover,
#start-untimed-test:hover,
#start-challenge:hover {
    background-color: #006cbd;
}

.text-display span {
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.text-display .correct {
    color: #4CAF50;
    transform: translateY(-2px) scale(1.05);
    animation: bounce 0.5s ease;
}

.text-display .incorrect {
    color: #f44336;
    background-color: rgba(244, 67, 54, 0.2);
}

.text-display .current {
    position: relative;
}

.text-display .current::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background-color: #0078d4;
    animation: cursor 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes cursor {
    0%, 100% {
    opacity: 1;
    transform: scaleX(1);
    }
    50% {
    opacity: 0.5;
    transform: scaleX(0.8);
    }
}

.space {
    margin-right: 4px;
}

#text-display span {
    white-space: pre;
}

#text-display {
    font-size: 1.5em;
    margin: 20px 0;
    padding: 20px;
    background-color: #2d2d2d;
    border-radius: 5px;
    line-height: 1.5;
    cursor: text;
    outline: none;
    position: relative;
}

#text-display:focus {
    box-shadow: 0 0 0 2px #0078d4;
}

.hidden {
    display: none !important;
}

#results-container {
    text-align: center;
    padding: 20px;
}

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

.results-stats div {
    background-color: #2d2d2d;
    padding: 20px;
    border-radius: 5px;
    font-size: 1.2em;
}

#wpm-chart {
    width: 100%;
    max-width: 600px;
    height: 300px;
    margin: 20px auto;
}

#retry-btn {
    padding: 10px 20px;
    font-size: 1.1em;
    background-color: #0078d4;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
}

#retry-btn:hover {
    background-color: #006cbd;
}

.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    background-color: #0078d4;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    animation: fall linear forwards;
    z-index: 1000;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

.new-record {
    color: #4CAF50;
    font-size: 0.8em;
    margin-top: 5px;
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    0% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-10px) scale(1.05); }
    50% { transform: translateY(0) scale(1.1); }
    75% { transform: translateY(-10px) scale(1.05); }
    100% { transform: translateY(0) scale(1); }
}

/* Smooth WPM counter animation */
#wpm, #accuracy {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wpm-change {
    animation: wpmPulse 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    #text-display {
        font-size: 1.2em;
    }

    #restart-btn, #retry-btn, #start-custom-test, #start-timed-test, #start-untimed-test {
        font-size: 1em;
        padding: 8px 16px;
    }
}

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

body.light-mode {
    background-color: #ffffff;
    color: #000000;
}

body.light-mode .text-display {
    background-color: #f0f0f0;
}

body.light-mode #restart-btn,
body.light-mode #retry-btn,
body.light-mode #start-custom-test,
body.light-mode #start-timed-test,
body.light-mode #start-untimed-test {
    background-color: #0078d4;
    color: white;
}

.button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.button-container textarea {
    width: 300px;
    height: 100px;
    margin: 10px;
    padding: 10px;
    font-size: 1em;
    background-color: #2d2d2d;
    color: #ffffff;
    border: 1px solid #0078d4;
    border-radius: 5px;
    resize: vertical;
}

.button-container button,
.button-container select {
    margin: 5px;
    padding: 10px 15px;
    font-size: 1em;
    background-color: #0078d4;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.button-container button:hover,
.button-container select:hover {
    background-color: #006cbd;
}

.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: #252525;
    border-radius: 5px;
    margin-bottom: 20px;
}

.button-container select {
    padding: 10px;
    font-size: 1em;
    background-color: #2d2d2d;
    color: #ffffff;
    border: 1px solid #0078d4;
    border-radius: 5px;
    cursor: pointer;
} 