/* CSS Variables for professional theme */
        :root {
            --primary-blue: #2563eb;
            --primary-blue-light: #3b82f6;
            --success-green: #059669;
            --error-red: #dc2626;
            --warning-orange: #d97706;
            --white: #ffffff;
            --gray-50: #f9fafb;
            --gray-100: #f3f4f6;
            --gray-200: #e5e7eb;
            --gray-500: #6b7280;
            --gray-700: #374151;
            --gray-900: #111827;
            --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
            --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
            --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
        }

        .dark-mode {
            --primary-blue: #3b82f6;
            --primary-blue-light: #60a5fa;
            --success-green: #10b981;
            --error-red: #ef4444;
            --warning-orange: #f59e0b;
            --white: #0f172a;
            --gray-50: #1e293b;
            --gray-100: #334155;
            --gray-200: #475569;
            --gray-500: #94a3b8;
            --gray-700: #cbd5e1;
            --gray-900: #f1f5f9;
        }

        /* Base styles */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        body {
            background-color: var(--white);
            color: var(--gray-900);
            line-height: 1.6;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            padding: 1.5rem;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* Header styles */
        header {
            text-align: center;
            margin-bottom: 2.5rem;
            padding: 1.5rem 0;
        }

        h1 {
            font-size: 2.75rem;
            margin-bottom: 0.75rem;
            color: var(--primary-blue);
            font-weight: 700;
            letter-spacing: -0.025em;
        }

        .subtitle {
            color: var(--gray-500);
            font-size: 1.125rem;
            margin-bottom: 2rem;
            font-weight: 400;
        }

        /* Stats bar */
        .stats-bar {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1.5rem;
            background-color: var(--gray-50);
            padding: 1.5rem 2rem;
            border-radius: 16px;
            box-shadow: var(--shadow-md);
            margin-bottom: 2.5rem;
            border: 1px solid var(--gray-200);
        }

        .stat-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        .stat-value {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--primary-blue);
            margin-bottom: 0.25rem;
        }

        .stat-label {
            font-size: 0.875rem;
            color: var(--gray-500);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            font-weight: 500;
        }

        .best-score {
            background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
            color: var(--white);
            padding: 0.75rem 1.5rem;
            border-radius: 12px;
            font-weight: 600;
            font-size: 0.9rem;
            box-shadow: var(--shadow-sm);
        }

        /* Controls */
        .controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2.5rem;
            flex-wrap: wrap;
            gap: 1.5rem;
        }

        .duration-selector {
            display: flex;
            gap: 0.75rem;
            background-color: var(--gray-50);
            padding: 0.5rem;
            border-radius: 12px;
            border: 1px solid var(--gray-200);
        }

        .duration-btn {
            background-color: transparent;
            color: var(--gray-500);
            border: none;
            border-radius: 8px;
            padding: 0.625rem 1.25rem;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s ease;
            font-weight: 500;
        }

        .duration-btn.active {
            background-color: var(--primary-blue);
            color: var(--white);
            box-shadow: var(--shadow-sm);
        }

        .theme-toggle {
            background: var(--gray-50);
            border: 1px solid var(--gray-200);
            color: var(--gray-700);
            font-size: 1.25rem;
            cursor: pointer;
            padding: 0.75rem;
            border-radius: 10px;
            transition: all 0.3s ease;
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .theme-toggle:hover {
            background-color: var(--gray-100);
            transform: translateY(-1px);
        }

        /* Main container */
        .container {
            max-width: 900px;
            margin: 0 auto;
            width: 100%;
        }

        /* Test area */
        .test-area {
            background-color: var(--gray-50);
            border-radius: 16px;
            padding: 2.5rem;
            box-shadow: var(--shadow-lg);
            margin-bottom: 2.5rem;
            border: 1px solid var(--gray-200);
        }

        .prompt-text {
            background-color: var(--white);
            padding: 2rem;
            border-radius: 12px;
            margin-bottom: 2rem;
            line-height: 1.8;
            font-size: 1.125rem;
            color: var(--gray-700);
            min-height: 160px;
            position: relative;
            border: 1px solid var(--gray-200);
            box-shadow: var(--shadow-sm);
        }

        .current-word {
            background-color: var(--primary-blue-light);
            color: var(--white);
            padding: 0.125rem 0.375rem;
            border-radius: 4px;
            font-weight: 500;
        }

        .typing-area {
            position: relative;
        }

        #user-input {
            width: 100%;
            min-height: 140px;
            background-color: var(--white);
            border: 2px solid var(--gray-200);
            border-radius: 12px;
            color: var(--gray-900);
            font-size: 1.125rem;
            padding: 1.5rem;
            resize: none;
            outline: none;
            transition: all 0.3s ease;
            line-height: 1.8;
            font-family: 'Inter', monospace;
        }

        #user-input:focus {
            border-color: var(--primary-blue);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }

        #user-input:disabled {
            background-color: var(--gray-100);
            cursor: not-allowed;
            opacity: 0.7;
        }

        /* Results screen */
        .results-screen {
            background-color: var(--gray-50);
            border-radius: 16px;
            padding: 3rem;
            box-shadow: var(--shadow-lg);
            margin-bottom: 2.5rem;
            text-align: center;
            display: none;
            border: 1px solid var(--gray-200);
        }

        .results-title {
            font-size: 2rem;
            margin-bottom: 2rem;
            color: var(--primary-blue);
            font-weight: 700;
        }

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

        .result-item {
            background-color: var(--white);
            padding: 2rem;
            border-radius: 12px;
            box-shadow: var(--shadow-md);
            border: 1px solid var(--gray-200);
        }

        .result-value {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 0.75rem;
        }

        .result-label {
            font-size: 0.9rem;
            color: var(--gray-500);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            font-weight: 600;
        }

        .wpm-value {
            color: var(--primary-blue);
        }

        .accuracy-value {
            color: var(--success-green);
        }

        .time-value {
            color: var(--warning-orange);
        }

        .chars-value {
            color: var(--gray-700);
        }

        .restart-btn {
            background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
            color: var(--white);
            border: none;
            border-radius: 12px;
            padding: 1rem 2.5rem;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: var(--shadow-md);
        }

        .restart-btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }

        /* Footer */
        footer {
            margin-top: auto;
            text-align: center;
            padding: 2rem;
            color: var(--gray-500);
            font-size: 0.875rem;
        }

        /* Responsive design */
        @media (max-width: 768px) {
            .stats-bar {
                grid-template-columns: repeat(2, 1fr);
                gap: 1rem;
            }
            
            .controls {
                flex-direction: column;
                align-items: stretch;
            }
            
            .duration-selector {
                justify-content: center;
            }
            
            .results-stats {
                grid-template-columns: 1fr;
            }
            
            h1 {
                font-size: 2.25rem;
            }
            
            .test-area, .results-screen {
                padding: 2rem;
            }
        }

        @media (max-width: 480px) {
            body {
                padding: 1rem;
            }
            
            .stats-bar {
                grid-template-columns: 1fr;
            }
            
            .stat-value {
                font-size: 1.5rem;
            }
            
            .result-value {
                font-size: 2rem;
            }
            
            .test-area, .results-screen {
                padding: 1.5rem;
            }
        }

        /* Character highlighting */
        .correct {
            color: var(--success-green);
            font-weight: 500;
        }

        .incorrect {
            color: var(--error-red);
            background-color: rgba(220, 38, 38, 0.1);
            border-radius: 2px;
            font-weight: 500;
        }

        /* Cursor animation */
        .cursor {
            display: inline-block;
            width: 2px;
            height: 1.4rem;
            background-color: var(--primary-blue);
            margin-left: 2px;
            animation: blink 1.2s infinite;
            vertical-align: middle;
        }

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

        /* Progress bar */
        .progress-container {
            width: 100%;
            height: 8px;
            background-color: var(--gray-200);
            border-radius: 4px;
            margin-bottom: 1.5rem;
            overflow: hidden;
        }

        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, var(--primary-blue), var(--primary-blue-light));
            width: 0%;
            transition: width 0.3s ease;
            border-radius: 4px;
        }