/* ===== متغيرات أساسية – ألوان نقية مع تأثيرات Vision Pro ===== */
        :root {
            --bg-primary: #ffffff;
            --bg-secondary: #f2f2f5;
            --text-primary: #1d1d1f;
            --text-secondary: #4a4a4e;
            --text-muted: #86868b;
            --accent: #9a836a;        /* لون ترابي هادئ */
            --accent-light: #d6c6b6;
            --accent-glow: rgba(154, 131, 106, 0.3);
            --border-light: rgba(0, 0, 0, 0.05);
            --card-bg: rgba(255, 255, 255, 0.6);
            --glass-bg: rgba(255, 255, 255, 0.3);
            --glass-border: rgba(255, 255, 255, 0.4);
            --shadow-sm: 0 20px 40px -20px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
            --shadow-hover: 0 40px 60px -20px rgba(0, 0, 0, 0.25), 0 0 0 2px var(--accent-light) inset, 0 0 30px var(--accent-glow);
            --transition-liquid: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
            --content-width: min(1400px, 90vw);
            --header-height: 85px;
            --radius-sm: 30px;
            --radius-md: 45px;
            --radius-lg: 60px;
            --radius-xl: 80px;
            --radius-full: 1000px;
        }

        [data-theme="dark"] {
            --bg-primary: #0c0c0e;
            --bg-secondary: #1a1a1e;
            --text-primary: #f5f5f7;
            --text-secondary: #d1d1d6;
            --text-muted: #8e8e93;
            --accent: #cbb8a4;
            --accent-light: #9a836a;
            --accent-glow: rgba(203, 184, 164, 0.3);
            --border-light: rgba(255, 255, 255, 0.1);
            --card-bg: rgba(30, 30, 35, 0.6);
            --glass-bg: rgba(20, 20, 25, 0.3);
            --glass-border: rgba(255, 255, 255, 0.1);
            --shadow-sm: 0 20px 40px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
            --shadow-hover: 0 40px 60px -20px rgba(0, 0, 0, 0.8), 0 0 0 2px var(--accent-light) inset, 0 0 40px var(--accent-glow);
        }

        /* ===== تحسين الأداء وإعادة الضبط ===== */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html {
            scroll-behavior: smooth;
        }

        body {
            background-color: var(--bg-primary);
            color: var(--text-primary);
            font-family: 'Inter', 'Tajawal', sans-serif;
            font-weight: 300;
            line-height: 1.6;
            direction: rtl;
            -webkit-font-smoothing: antialiased;
            transition: background-color 0.4s, color 0.4s;
            position: relative;
            overflow-x: hidden;
        }

        /* خلفية متحركة سائلة (فقاعات خفيفة) */
        body::before {
            content: '';
            position: fixed;
            inset: 0;
            background: radial-gradient(circle at 30% 30%, var(--accent-glow) 0%, transparent 30%),
                        radial-gradient(circle at 80% 70%, rgba(154, 131, 106, 0.1) 0%, transparent 35%),
                        repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 2px, transparent 2px, transparent 6px);
            pointer-events: none;
            z-index: -1;
            opacity: 0.8;
            animation: none;
            will-change: transform, filter;
        }

        @keyframes liquidMove {
            0% { transform: scale(1) translate(0, 0); filter: blur(0px); }
            100% { transform: scale(1.05) translate(-2%, -1%); filter: blur(2px); }
        }

        .container {
            max-width: var(--content-width);
            margin: 0 auto;
            padding: 0 2rem;
            position: relative;
            z-index: 2;
        }

        /* ===== الخطوط ===== */
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Amiri', serif;
            font-weight: 500;
            line-height: 1.2;
            color: var(--text-primary);
        }

        p, .text-secondary {
            font-family: 'Inter', 'Tajawal', sans-serif;
            color: var(--text-secondary);
        }

        /* ===== روابط وأزرار سائلة ===== */
        a {
            text-decoration: none;
            color: inherit;
        }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.7rem;
            padding: 1rem 2.5rem;
            background: var(--accent);
            color: white;
            border-radius: var(--radius-full);
            font-weight: 500;
            font-size: 1rem;
            border: none;
            cursor: pointer;
            transition: all var(--transition-liquid);
            box-shadow: 0 4px 20px var(--accent-glow);
            backdrop-filter: blur(15px);
            position: relative;
            overflow: hidden;
            will-change: transform, box-shadow;
        }

        .btn::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(120deg, transparent, rgba(255,255,255,0.4), transparent);
            transform: translateX(-100%);
            transition: transform 0.6s;
        }

        .btn:hover::before {
            transform: translateX(100%);
        }

        .btn:hover {
            background: var(--accent-light);
            transform: scale(1.02) translateY(-2px);
            box-shadow: 0 15px 40px var(--accent-glow);
        }

        .btn-outline {
            background: transparent;
            border: 1px solid rgba(255,255,255,0.4);
            color: white;
            backdrop-filter: blur(20px);
        }

        .btn-outline:hover {
            background: rgba(255,255,255,0.2);
            border-color: white;
            color: white;
        }

        .btn-sm {
            padding: 0.5rem 1.5rem;
            font-size: 0.95rem;
            background: var(--accent);
            color: white;
            border-radius: var(--radius-full);
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            transition: all 0.3s;
        }

        .btn-sm:hover {
            background: var(--accent-light);
            gap: 0.8rem;
        }

        /* ===== هيدر زجاجي فائق مع تأثير سائل ===== */
        .header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.8rem 2rem;
            background: var(--glass-bg);
            backdrop-filter: blur(30px);
            -webkit-backdrop-filter: blur(30px);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-full);
            margin: 1.5rem 0 2rem;
            box-shadow: var(--shadow-sm);
            position: sticky;
            top: 1.5rem;
            z-index: 100;
            height: var(--header-height);
            transition: all 0.4s;
            will-change: backdrop-filter, box-shadow;
        }

        .header.scrolled {
            background: var(--card-bg);
            backdrop-filter: blur(40px);
            box-shadow: 0 15px 40px -15px rgba(0,0,0,0.2);
        }

        .logo {
            font-family: 'Amiri', serif;
            font-size: 2.2rem;
            font-weight: 600;
            background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            transition: all 0.3s;
        }

        .nav-links {
            display: flex;
            gap: 3rem;
        }

        .nav-links a {
            font-size: 1rem;
            color: var(--text-secondary);
            position: relative;
            padding-bottom: 0.25rem;
            transition: color 0.3s;
        }

        .nav-links a::after {
            content: '';
            position: absolute;
            bottom: 0;
            right: 0;
            width: 0;
            height: 2px;
            background: var(--accent);
            transition: width 0.4s cubic-bezier(0.65, 0, 0.35, 1);
        }

        .nav-links a:hover {
            color: var(--text-primary);
        }

        .nav-links a:hover::after {
            width: 100%;
        }

        .nav-links a.active {
            color: var(--accent);
        }

        .nav-links a.active::after {
            width: 100%;
        }

        .header-actions {
            display: flex;
            gap: 0.8rem;
        }

        .header-actions button,
        .header-actions a {
            background: var(--card-bg);
            border: 1px solid var(--glass-border);
            color: var(--text-secondary);
            width: 45px;
            height: 45px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.4s;
            backdrop-filter: blur(10px);
            cursor: pointer;
            font-size: 1.2rem;
            will-change: transform, background;
        }

        .header-actions button:hover,
        .header-actions a:hover {
            background: var(--accent);
            color: white;
            border-color: var(--accent);
            transform: scale(1.1) rotate(5deg);
        }

        /* ===== شريط البحث في الهيدر ===== */
        .header-search {
            position: relative;
            max-width: 400px;
            width: 100%;
            margin: 0 20px;
        }

        .header-search input {
            width: 100%;
            padding: 0.8rem 1rem 0.8rem 3rem;
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-full);
            background: var(--card-bg);
            backdrop-filter: blur(10px);
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.95rem;
            transition: all 0.3s;
        }

        .header-search input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--accent-glow);
        }

        .header-search button {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            background: var(--accent);
            border: none;
            color: white;
            width: 35px;
            height: 35px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s;
        }

        .header-search button:hover {
            background: var(--accent-light);
            transform: translateY(-50%) scale(1.1);
        }

        /* ===== زر القائمة المتنقلة ===== */
        .mobile-menu-btn {
            display: none;
            background: var(--card-bg);
            border: 1px solid var(--glass-border);
            color: var(--text-secondary);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0.8rem;
            border-radius: 50%;
            transition: all 0.3s;
        }

        .mobile-menu-btn:hover {
            background: var(--accent);
            color: white;
        }

        /* ===== 🧠 صفحة تفاصيل الكويز ===== */
        .quiz-detail-page {
            margin: 2rem 0 4rem;
        }

        .quiz-header {
            background: var(--card-bg);
            backdrop-filter: blur(15px);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-xl);
            padding: 3rem;
            text-align: center;
            box-shadow: var(--shadow-sm);
            transition: box-shadow 0.4s;
            margin-bottom: 2rem;
        }

        .quiz-header:hover {
            box-shadow: var(--shadow-hover);
        }

        .quiz-header h1 {
            font-size: 2.5rem;
            color: var(--accent);
            margin-bottom: 1rem;
        }

        .quiz-header p {
            color: var(--text-secondary);
            max-width: 600px;
            margin: 0 auto 2rem;
            font-size: 1.2rem;
        }

        .quiz-meta-info {
            display: flex;
            justify-content: center;
            gap: 2rem;
            flex-wrap: wrap;
        }

        .meta-item {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            background: rgba(154, 131, 106, 0.1);
            padding: 0.8rem 1.5rem;
            border-radius: var(--radius-full);
            color: var(--accent);
            font-weight: 500;
            border: 1px solid var(--border-light);
        }

        .meta-item i {
            font-size: 1.2rem;
        }

        /* ===== شريط التقدم ===== */
        .quiz-progress {
            background: var(--card-bg);
            backdrop-filter: blur(15px);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-lg);
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: var(--shadow-sm);
        }

        .progress-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            color: var(--text-secondary);
        }

        .progress-bar {
            width: 100%;
            height: 8px;
            background: rgba(154, 131, 106, 0.2);
            border-radius: var(--radius-full);
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: var(--accent);
            border-radius: var(--radius-full);
            transition: width 0.5s ease;
        }

        .quiz-timer {
            background: rgba(154, 131, 106, 0.12);
            color: var(--accent);
            border: 1px solid var(--border-light);
            border-radius: var(--radius-full);
            padding: 0.35rem 0.9rem;
            font-weight: 600;
        }

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

        .related-quiz-card {
            border: 1px solid var(--border-light);
            border-radius: var(--radius-md);
            padding: 1rem;
            background: var(--card-bg);
            text-decoration: none;
            color: var(--text-primary);
        }

        .related-quiz-card small {
            color: var(--text-muted);
            display: block;
            margin-top: 0.4rem;
        }

        /* ===== نموذج الأسئلة ===== */
        .quiz-form {
            background: var(--card-bg);
            backdrop-filter: blur(15px);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-xl);
            padding: 3rem;
            box-shadow: var(--shadow-sm);
            transition: box-shadow 0.4s;
        }

        .quiz-form:hover {
            box-shadow: var(--shadow-hover);
        }

        .question-box {
            background: rgba(154, 131, 106, 0.05);
            border: 1px solid var(--border-light);
            border-radius: var(--radius-lg);
            padding: 2.5rem;
            margin-bottom: 2rem;
            transition: all 0.4s;
            opacity: 0;
            transform: translateY(30px);
            animation: fadeInUp 0.8s ease forwards;
        }

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

        .question-box:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-hover);
        }

        .question-box h4 {
            font-size: 1.4rem;
            color: var(--text-primary);
            margin-bottom: 1.5rem;
        }

        .choice-option {
            display: block;
            background: rgba(255,255,255,0.05);
            padding: 1rem 1.5rem;
            margin-bottom: 1rem;
            border-radius: var(--radius-md);
            border: 2px solid transparent;
            cursor: pointer;
            transition: all 0.3s;
            position: relative;
            color: var(--text-secondary);
        }

        .choice-option:hover {
            border-color: var(--accent);
            transform: translateX(-5px);
            background: rgba(154, 131, 106, 0.1);
        }

        .choice-option input[type="radio"] {
            display: none;
        }

        .choice-option.selected {
            background: rgba(154, 131, 106, 0.15);
            border-color: var(--accent);
            color: var(--text-primary);
        }

        .choice-option:before {
            content: '';
            position: absolute;
            left: 1.5rem;
            top: 50%;
            transform: translateY(-50%);
            width: 20px;
            height: 20px;
            border: 2px solid var(--border-light);
            border-radius: 50%;
            transition: all 0.3s;
        }

        .choice-option.selected:before {
            border-color: var(--accent);
            background: var(--accent);
        }

        .btn-next {
            background: var(--accent);
            color: white;
            border: none;
            padding: 1rem 2.5rem;
            border-radius: var(--radius-full);
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 1.5rem;
            display: inline-block;
        }

        .btn-next:hover {
            background: var(--accent-light);
            transform: translateY(-2px);
        }

        .btn-submit {
            background: var(--accent);
            color: white;
            border: none;
            padding: 1.2rem 3rem;
            border-radius: var(--radius-full);
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            display: block;
            margin: 2rem auto 0;
            font-size: 1.1rem;
        }

        .btn-submit:hover {
            background: var(--accent-light);
            transform: translateY(-2px);
        }

        /* ===== Scroll Progress ===== */
        .scroll-progress {
            position: fixed;
            top: 0;
            right: 0;
            width: 0%;
            height: 3px;
            background: linear-gradient(to left, var(--accent), var(--accent-light));
            z-index: 1001;
            transition: width 0.1s ease;
        }

        /* ===== Loading Screen ===== */
        .loading-screen {
            position: fixed;
            inset: 0;
            background: var(--bg-primary);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.5s ease, visibility 0.5s ease;
        }

        .loading-screen.hidden {
            opacity: 0;
            visibility: hidden;
        }

        .loader {
            width: 50px;
            height: 50px;
            border: 3px solid var(--border-light);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 1rem;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* ===== Back to Top ===== */
        .back-to-top {
            position: fixed;
            bottom: 30px;
            left: 30px;
            width: 50px;
            height: 50px;
            background: var(--accent);
            color: white;
            border: none;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 0;
            visibility: hidden;
            transform: translateY(20px);
            transition: all var(--transition-liquid);
            z-index: 999;
            box-shadow: 0 5px 20px var(--accent-glow);
        }

        .back-to-top.visible {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .back-to-top:hover {
            background: var(--accent-light);
            transform: translateY(-5px);
            box-shadow: 0 8px 30px var(--accent-glow);
        }

        /* ===== Footer متطور ===== */
        .footer {
            margin-top: 5rem;
            padding: 4rem 0 2rem;
            border-top: 1px solid var(--border-light);
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 2.5rem;
        }

        .footer-col h4 {
            font-size: 1.5rem;
            margin-bottom: 1.2rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .footer-col p, .footer-col a {
            color: var(--text-muted);
            line-height: 2;
            display: block;
            transition: all 0.3s;
        }

        .footer-col a:hover {
            color: var(--accent);
            transform: translateX(-5px);
        }

        .social-links {
            display: flex;
            gap: 1.2rem;
            margin-top: 1.5rem;
        }

        .social-links a {
            background: var(--card-bg);
            border: 1px solid var(--glass-border);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.3rem;
            color: var(--text-muted);
            transition: all 0.4s;
            will-change: transform, background;
        }

        .social-links a:hover {
            background: var(--accent);
            color: white;
            transform: translateY(-5px) scale(1.1);
            border-color: var(--accent);
        }

        .copyright {
            grid-column: 1 / -1;
            text-align: center;
            padding-top: 2rem;
            margin-top: 2rem;
            border-top: 1px solid var(--border-light);
            color: var(--text-muted);
            font-size: 0.95rem;
        }

        .question-box {
            overflow-wrap: anywhere;
        }

        .question-box img,
        .question-box video,
        .question-box iframe {
            max-width: 100%;
            height: auto;
            border-radius: var(--radius-md);
        }

        .question-box table {
            display: block;
            width: 100%;
            max-width: 100%;
            overflow-x: auto;
            white-space: nowrap;
        }

        /* ===== تحسينات للشاشات الصغيرة ===== */
        @media (max-width: 992px) {
            .header {
                flex-wrap: wrap;
                height: auto;
                padding: 0.8rem 1rem;
                border-radius: 50px;
            }
            .nav-links {
                order: 3;
                width: 100%;
                justify-content: center;
                margin-top: 1rem;
                gap: 1.2rem;
            }
            .header-search {
                margin: 0;
                max-width: 100%;
            }
            .mobile-menu-btn {
                display: block;
            }
            .quiz-header h1 {
                font-size: 2rem;
            }
            .quiz-meta-info {
                gap: 1rem;
            }
        }

        @media (max-width: 768px) {
            .container { padding: 0 1rem; }
            .quiz-header {
                padding: 2rem;
            }
            .quiz-header h1 {
                font-size: 1.8rem;
            }
            .quiz-meta-info {
                flex-direction: column;
                align-items: center;
            }
            .quiz-form {
                padding: 1.5rem;
            }
            .question-box {
                padding: 1.5rem;
            }
            .question-box h4 {
                font-size: 1.2rem;
            }
            .footer {
                grid-template-columns: 1fr;
                text-align: center;
            }
            .social-links {
                justify-content: center;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            * {
                animation-duration: 0.01ms !important;
                transition-duration: 0.01ms !important;
            }
        }
