 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

        :root {
            --primary-color: #2563eb;
            --primary-hover: #1d4ed8;
            --bg-color: #f8fafc;
            --card-bg: #ffffff;
            --text-main: #1e293b;
            --text-muted: #64748b;
            --border-color: #e2e8f0;
            --success: #10b981;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Inter', sans-serif;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-main);
            display: flex;
            justify-content: center;
            align-items: flex-start;
            min-height: 100vh;
            padding: 80px 20px 20px 20px; /* Adjusted for navbar */
        }

        /* --- NEW: NAVBAR & SIDEBAR --- */
        .navbar {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            background: var(--card-bg);
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 30px;
            z-index: 1000;
        }

        .brand {
            font-size: 24px;
            font-weight: 700;
            color: var(--primary-color);
            letter-spacing: -0.5px;
        }

        .hamburger {
            font-size: 28px;
            cursor: pointer;
            color: var(--text-main);
            transition: color 0.2s;
        }

        .hamburger:hover {
            color: var(--primary-color);
        }

        .sidebar {
            position: fixed;
            top: 0;
            right: -300px;
            width: 280px;
            height: 100vh;
            background: var(--card-bg);
            box-shadow: -5px 0 15px rgba(0,0,0,0.05);
            transition: right 0.3s ease;
            z-index: 1001;
            padding: 80px 20px 20px 20px;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .sidebar.open {
            right: 0;
        }

        .close-btn {
            position: absolute;
            top: 20px;
            right: 25px;
            font-size: 30px;
            cursor: pointer;
            color: var(--text-main);
        }

        .menu-item {
            padding: 15px 20px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            color: var(--text-main);
            text-decoration: none;
            transition: all 0.2s;
            cursor: pointer;
        }

        .menu-item:hover, .menu-item.active-menu {
            background: var(--primary-color);
            color: white;
        }

        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.4);
            z-index: 999;
            display: none;
            opacity: 0;
            transition: opacity 0.3s;
        }
        .overlay.show {
            display: block;
            opacity: 1;
        }
        /* --- END NEW --- */

        .container {
            width: 100%;
            max-width: 700px;
            display: none; /* Controlled by JS now */
        }

        .container.active-page {
            display: block;
        }

        .card {
            background: var(--card-bg);
            border-radius: 12px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
            padding: 40px;
            border: 1px solid var(--border-color);
            display: none;
            animation: fadeIn 0.4s ease-in-out;
        }

        .card.active {
            display: block;
        }

        h1, h2, h3 {
            color: var(--text-main);
            margin-bottom: 15px;
        }

        p {
            color: var(--text-muted);
            line-height: 1.6;
            margin-bottom: 25px;
        }

        .btn {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 12px 24px;
            font-size: 16px;
            font-weight: 600;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.2s;
            display: inline-block;
            width: 100%;
            text-align: center;
        }

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

        .btn-outline {
            background-color: transparent;
            color: var(--primary-color);
            border: 2px solid var(--primary-color);
            margin-top: 10px;
        }
        .btn-outline:hover {
            background-color: #eff6ff;
        }

        .progress-container {
            width: 100%;
            background-color: var(--border-color);
            border-radius: 8px;
            height: 8px;
            margin-bottom: 30px;
            overflow: hidden;
        }

        .progress-bar {
            height: 100%;
            background-color: var(--primary-color);
            width: 0%;
            transition: width 0.3s ease;
        }

        .question-number {
            font-size: 14px;
            font-weight: 600;
            color: var(--primary-color);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 10px;
            display: block;
        }

        .question-text {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 25px;
        }

        .options-grid {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 30px;
        }

        .option-btn {
            background-color: transparent;
            border: 2px solid var(--border-color);
            padding: 15px 20px;
            border-radius: 8px;
            font-size: 16px;
            color: var(--text-main);
            cursor: pointer;
            text-align: left;
            transition: all 0.2s ease;
            font-weight: 500;
        }

        .option-btn:hover {
            border-color: var(--primary-color);
            background-color: #eff6ff;
        }

        .option-btn.selected {
            border-color: var(--primary-color);
            background-color: var(--primary-color);
            color: white;
        }

        .nav-buttons {
            display: flex;
            justify-content: flex-end;
        }

        .nav-buttons .btn {
            width: auto;
            min-width: 120px;
        }

        .result-box {
            text-align: center;
            padding: 20px 0;
        }

        .iq-score {
            font-size: 64px;
            font-weight: 700;
            color: var(--primary-color);
            margin: 20px 0;
        }

        .iq-category {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 15px;
        }

        /* --- NEW: HISTORY STATS STYLING --- */
        .stat-row {
            margin-bottom: 20px;
            text-align: left;
        }
        .stat-label {
            display: flex;
            justify-content: space-between;
            font-weight: 600;
            margin-bottom: 8px;
            font-size: 14px;
        }
        .stat-bar-bg {
            width: 100%;
            background: var(--border-color);
            height: 10px;
            border-radius: 5px;
            overflow: hidden;
        }
        .stat-bar-fill {
            height: 100%;
            background: var(--success);
            width: 0%;
            transition: width 1s ease;
        }
        .share-box {
            background: #eff6ff;
            padding: 15px;
            border-radius: 8px;
            margin: 20px 0;
            border: 1px dashed var(--primary-color);
            display: none;
        }
        .share-input {
            width: 100%;
            padding: 10px;
            border: 1px solid var(--border-color);
            border-radius: 5px;
            margin-top: 10px;
            font-size: 12px;
            color: var(--text-muted);
        }
        .empty-history {
            text-align: center;
            padding: 40px 0;
            color: var(--text-muted);
            font-style: italic;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
          }
          
