
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }


        .loader-bg {
            background: linear-gradient(-45deg, #4f46e5, #3b82f6, #6366f1, #8b5cf6);
            background-size: 400% 400%;
            animation: gradient 15s ease infinite;
        }

        .loader-circle {
            width: 100%;
            height: 100%;
            border: 4px solid rgba(255, 255, 255, 0.2);
            border-top-color: white;
            border-radius: 50%;
            animation: loader-spin 1s linear infinite;
        }

        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        @keyframes loader-spin {
            to { transform: rotate(360deg); }
        }

        #loaderScreen {
            opacity: 1;
            visibility: visible;
            transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
        }

        #loaderScreen.hidden {
            opacity: 0;
            visibility: hidden;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
            min-height: 100vh;
        }

        .typing-text {
            font-family: 'JetBrains Mono', monospace;
            font-size: 24px;
            line-height: 1.8;
            letter-spacing: 0.5px;
        }

        .char {
            transition: all 0.1s ease;
        }

        .char.correct {
            color: #10b981;
        }

        .char.incorrect {
            color: #ef4444;
            background-color: rgba(239, 68, 68, 0.1);
            border-radius: 2px;
        }

        .char.current {
            position: relative;
            color: #0f172a;
            font-weight: 600;
        }

        .char.current::before {
            content: '';
            position: absolute;
            left: -1px;
            top: 0;
            width: 2px;
            height: 100%;
            background: linear-gradient(to bottom, #3b82f6, #8b5cf6);
            animation: blink 1s infinite, glow 2s infinite;
        }

        @keyframes blink {
            0%, 49% { opacity: 1; }
            50%, 100% { opacity: 0; }
        }

        @keyframes glow {
            0%, 100% { box-shadow: 0 0 5px #3b82f6; }
            50% { box-shadow: 0 0 15px #3b82f6, 0 0 25px #3b82f6; }
        }

        .stat-card {
            transition: all 0.3s ease;
        }

        .stat-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
        }

        .mode-btn {
            transition: all 0.2s ease;
        }

        .mode-btn:hover {
            transform: scale(1.05);
        }

        .mode-btn.active {
            background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        }

        .btn-primary {
            background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
            transition: all 0.2s ease;
        }

        .btn-primary:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
        }

        .btn-primary:active {
            transform: scale(0.98);
        }

        .modal-overlay {
            backdrop-filter: blur(8px);
            animation: fadeIn 0.2s ease;
        }

        .modal-content {
            animation: slideUp 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes slideUp {
            from { transform: translateY(20px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        .achievement-badge {
            animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }

        @keyframes popIn {
            0% { transform: scale(0); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }

        .progress-ring {
            transform: rotate(-90deg);
            transform-origin: center;
        }

        .progress-ring-circle {
            transition: stroke-dashoffset 0.5s ease;
        }

        .heat-map-cell {
            transition: all 0.2s ease;
        }

        .heat-map-cell:hover {
            transform: scale(1.1);
            filter: brightness(1.2);
        }

        .wpm-graph {
            position: relative;
            height: 200px;
        }

        .graph-line {
            stroke: #3b82f6;
            stroke-width: 3;
            fill: none;
            filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.3));
        }

        .graph-area {
            fill: url(#gradient);
            opacity: 0.2;
        }

        .tooltip {
            position: absolute;
            background: rgba(15, 23, 42, 0.95);
            color: white;
            padding: 8px 12px;
            border-radius: 6px;
            font-size: 12px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s;
            z-index: 1000;
        }

        .leaderboard-entry {
            transition: all 0.2s ease;
        }

        .leaderboard-entry:hover {
            background: rgba(59, 130, 246, 0.05);
            transform: translateX(4px);
        }

        .scroll-smooth {
            scroll-behavior: smooth;
        }

        .custom-scrollbar::-webkit-scrollbar {
            width: 8px;
        }

        .custom-scrollbar::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 4px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 4px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

        /* Navbar and dark-mode tweaks */
        nav[role="navigation"] {
            transition: background-color 0.2s ease, box-shadow 0.2s ease;
        }

        /* simple dark mode styles applied when JS toggles .dark on body */
        body.dark {
            background: linear-gradient(135deg, #0f172a 0%, #071024 100%);
            color: #e6eef8;
        }

        body.dark .modal-content,
        body.dark .modal-overlay,
        body.dark .modal-content .bg-white {
            background-color: #0b1220 !important;
            color: #e6eef8 !important;
        }

        /* small focus ring improvements for accessibility */
        input:focus, button:focus {
            outline: none;
            box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
        }

        .hidden { display: none !important; }
