:root {
    --bg-color: #0D1117;
    --text-color: #c9d1d9;
    --main-color: #00e6e6; /* The glowing cyan */
    --sub-color: #6a737d;  /* Untyped text, footers */
    --error-color: #f85149;
    --caret-color: var(--main-color);
    --font-family: 'Roboto Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden;
    
        padding-bottom: 120px;
}

/* --- LAYOUT FIX: Centering Wrapper --- */
.wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 1rem;
padding-bottom: 150px;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
        margin-bottom: 20px;
    max-width: 1000px; /* Increased max-width for better layout */
    transition: all 0.3s ease;
}

/* --- FOCUS MODE & TRANSITIONS --- */
.focus-mode .header,
.focus-mode .footer,
.focus-mode .test-config {
    opacity: 0;
    pointer-events: none;
}

.focus-mode #live-stats {
    opacity: 1;
    transform: translateY(0);
}

.header, .footer, .test-config, #live-stats {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.title {
    font-size: 2rem;
    font-weight: 500;
    color: var(--main-color);
    text-shadow: 0 0 8px var(--main-color);
}

#live-stats {
    font-size: 2rem;
    color: var(--main-color);
    opacity: 0;
    transform: translateY(10px);
    height: 32px; /* Reserve space to prevent layout shift */
}

/* --- LAYOUT FIX: Single line config --- */
.test-config {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap; /* Allow wrapping on very small screens */
    width: 100%;
}

.separator {
    height: 2rem;
    width: 1px;
    background-color: var(--sub-color);
    opacity: 0.5;
}

.config-button {
    background: transparent;
    border: none;
    color: var(--sub-color);
    font-family: var(--font-family);
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-button:hover {
    color: var(--text-color);
}

.config-button.active {
    color: var(--main-color);
}

/* --- SCROLLING & CURSOR FIX --- */
.typing-test-wrapper {
    width: 100%;
    position: relative;
}

#text-display-container {
    position: relative;
    outline: none;
    padding: 2rem;
    user-select: none;
    max-height: 135px;
    overflow-y: scroll; /* Use native browser scrolling */
    scroll-behavior: smooth; /* Smooth scrolling */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
#text-display-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}
 
#text-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0;
    font-size: 1.8rem;
    line-height: 1.6;
    color: var(--sub-color);
}

.word {
    display: flex;
    margin-right: 0.75rem;
    border-bottom: 2px solid transparent;
}
.word.active {
    border-bottom-color: var(--main-color);
}

.correct { color: var(--text-color); }
.incorrect { color: var(--error-color); text-decoration: underline; text-decoration-color: var(--error-color); }
.incorrect.space { background-color: var(--error-color); }

.caret {
    width: 2px;
    background-color: var(--caret-color);
    border-radius: 2px;
    position: absolute;
    animation: blink 1s infinite;
    /* CHANGE THIS LINE for a smoother feel */
    transition: left 0.1s ease, top 0.1s ease; 
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- FOOTER & RESULTS --- */
footer { font-size: 0.9rem; color: var(--sub-color); }
footer span { color: var(--text-color); background-color: rgba(255, 255, 255, 0.1); padding: 0.2rem 0.5rem; border-radius: 4px; }
#results-screen { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2rem; transition: opacity 0.3s ease; }
#results-screen.hidden, .typing-test-wrapper.hidden, #live-stats.hidden { display: none; }
#results-screen .stats { display: flex; gap: 3rem; }
#results-screen .stat-item { display: flex; flex-direction: column; align-items: center; }
#results-screen .label { font-size: 1rem; color: var(--sub-color); margin-bottom: 0.5rem; }
#results-screen .value { font-size: 3rem; font-weight: 500; color: var(--main-color); text-shadow: 0 0 8px var(--main-color); }
#reset-btn-results { background: transparent; border: none; color: var(--sub-color); font-size: 2rem; cursor: pointer; transition: all 0.2s ease; }
#reset-btn-results:hover { color: var(--main-color); transform: rotate(360deg); transition-duration: 1s; }