:root {
    --primary-color: #4a90e2;
    --secondary-color: #2c3e50;
    --background-color: #ffffff;
    --text-color: #333333;
    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary-color: #64b5f6;
    --secondary-color: #34495e;
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --error-color: #ff6b6b;
    --success-color: #4caf50;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.theme-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 1000;
}

header {
    text-align: center;
    padding: 2rem 1rem;
    background-color: var(--primary-color);
    color: white;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 1.2rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
    animation: typing 1s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.test-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stats {
    display: flex;
    gap: 1rem;
}

.stat-box {
    background-color: var(--background-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: color 0.3s;
}

.stat-value.active {
    color: var(--success-color);
    animation: pulse 1s infinite;
}

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

.timer-controls {
    display: flex;
    gap: 0.5rem;
}

.timer-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.timer-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.timer-btn:hover::after {
    width: 200%;
    height: 200%;
}

.timer-btn.active {
    background-color: var(--primary-color);
    color: white;
    animation: buttonPulse 2s infinite;
}

@keyframes buttonPulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(74, 144, 226, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 144, 226, 0); }
}

.test-content {
    margin-bottom: 2rem;
}

.text-display {
    background-color: var(--background-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 150px;
    border: 2px solid var(--border-color);
    font-size: 1.1rem;
    line-height: 1.8;
}

.text-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    resize: none;
    min-height: 100px;
    background-color: var(--background-color);
    color: var(--text-color);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.test-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.control-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.control-btn:hover {
    background-color: var(--secondary-color);
}

.leaderboard {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
}

.leaderboard h2 {
    text-align: center;
    margin-bottom: 1rem;
}

#leaderboard-list {
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 1rem;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.seo-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

article {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

article h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

article ul {
    list-style-position: inside;
    margin-top: 1rem;
}

.ad-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
}

footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--secondary-color);
    color: white;
    margin-top: 2rem;
}

.error {
    color: var(--error-color);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .test-header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats {
        justify-content: space-between;
    }

    .timer-controls {
        justify-content: center;
    }

    header h1 {
        font-size: 2rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}

.results {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
}

.result-box {
    background-color: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    text-align: center;
}

#past-results-list {
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 1rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-box.hidden {
    display: none;
}

.hidden {
    display: none;
}

.no-style {
    all: unset;/* Revert to default link color */
    text-decoration: none;
    cursor: pointer;
}
