/* ===== Sleek Dark UI (Monkeytype Inspired) ===== */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Lexend+Deca:wght@400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body {
    font-family: 'Lexend Deca', sans-serif;
    background-color: #323437; /* Dark grayish black */
    color: #646669; /* Muted text */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Header */
h1 {
    text-align: left;
    color: #d1d0c5;
    font-size: 2.2em;
    font-weight: 600;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 15px;
}
h1 i {
    color: #e2b714; /* Yellow accent */
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border-radius: 10px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-box h3 {
    font-size: 0.85em;
    font-weight: 500;
    color: #646669;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-box div {
    font-size: 2.5em;
    font-weight: 600;
    color: #d1d0c5;
    font-family: 'JetBrains Mono', monospace;
}

.stat-box #timer {
    color: #e2b714;
}

/* Typing Display */
.text-display {
    position: relative;
    font-size: 1.8em;
    line-height: 1.6;
    min-height: 180px;
    font-family: 'JetBrains Mono', monospace;
    color: #646669;
    user-select: none;
    letter-spacing: 1px;
    z-index: 10;
}

.text-display .correct {
    color: #d1d0c5; /* White/Cream */
}

.text-display .incorrect {
    color: #ca4754; /* Red */
    border-bottom: 2px solid #ca4754;
    background: rgba(202, 71, 84, 0.15);
}

.text-display .current {
    color: #d1d0c5;
    position: relative;
}

.text-display .current::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 100%;
    height: 3px;
    background-color: #e2b714; /* Accent color under current letter */
    border-radius: 2px;
    animation: blink 1s infinite alternate;
}

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

/* Hidden Text Area */
#typingArea {
    position: absolute;
    opacity: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
    z-index: -1;
}

/* Custom overlay for clicking */
.typing-overlay {
    position: relative;
    cursor: text;
}
.typing-overlay:focus-within .text-display {
    opacity: 1;
}
.typing-overlay:not(:focus-within) .text-display {
    opacity: 0.5;
    filter: blur(2px);
}
.start-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    color: #d1d0c5;
    display: none;
    pointer-events: none;
    z-index: 20;
}
.typing-overlay:not(:focus-within) .start-prompt {
    display: block;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.start-btn, .reset-btn {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 500;
    font-family: 'Lexend Deca', sans-serif;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: #2c2e31;
    color: #d1d0c5;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.start-btn:hover:not(:disabled), .reset-btn:hover {
    background: #d1d0c5;
    color: #2c2e31;
}

.start-btn:disabled {
    background: #232427;
    color: #646669;
    cursor: not-allowed;
}

/* Media Queries */
@media (max-width: 768px) {
    .text-display {
        font-size: 1.3em;
    }
    
    .stat-box div {
        font-size: 1.8em;
    }
    
    h1 {
        font-size: 1.8em;
    }
}
