  /* ======================== ELEGANT MATH SYSTEM ======================== */
        @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&family=Amiri:wght@400;700&display=swap');

        :root {
            /* Elegant Color Palette */
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --accent-color: #e74c3c;
            --success-color: #27ae60;
            --warning-color: #f39c12;
            --info-color: #9b59b6;
            --light-color: #ecf0f1;
            --dark-color: #2c3e50;
            
            /* Elegant Gradients */
            --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
            --gradient-warning: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
            --gradient-info: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
            --gradient-accent: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
            
            /* Advanced Design Variables */
            --shadow-soft: 0 20px 60px rgba(0, 0, 0, 0.08);
            --shadow-medium: 0 25px 80px rgba(0, 0, 0, 0.12);
            --shadow-strong: 0 30px 100px rgba(0, 0, 0, 0.15);
            --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);
            --border-radius: 25px;
            --border-radius-small: 15px;
            --transition: all 0.6s cubic-bezier(0.23, 1, 0.320, 1);
            --transition-fast: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

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

        body {
            font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.8;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
            background-attachment: fixed;
            min-height: 100vh;
            padding: 20px;
            font-size: 16px;
            color: #2c3e50;
            overflow-x: hidden;
        }

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
            pointer-events: none;
            z-index: -1;
        }

        .math-container {
            max-width: 1400px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: var(--border-radius);
            padding: 60px;
            box-shadow: var(--shadow-strong);
            border: 1px solid rgba(255, 255, 255, 0.2);
            position: relative;
            overflow: hidden;
            animation: containerSlideIn 1s ease-out;
        }

        .math-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 8px;
            background: var(--gradient-primary);
            background-size: 300% 100%;
            animation: gradientFlow 6s ease-in-out infinite;
        }

        .math-container::after {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: 
                radial-gradient(circle, rgba(102, 126, 234, 0.03) 1px, transparent 1px);
            background-size: 50px 50px;
            pointer-events: none;
            animation: patternMove 20s linear infinite;
        }

        @keyframes containerSlideIn {
            from {
                transform: translateY(50px) scale(0.95);
                opacity: 0;
            }
            to {
                transform: translateY(0) scale(1);
                opacity: 1;
            }
        }

        @keyframes gradientFlow {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }

        @keyframes patternMove {
            0% { transform: translate(0, 0); }
            100% { transform: translate(50px, 50px); }
        }

        .math-header {
            text-align: center;
            margin-bottom: 60px;
            padding: 40px;
            background: rgba(102, 126, 234, 0.08);
            border-radius: var(--border-radius);
            position: relative;
            overflow: hidden;
        }

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

        @keyframes shimmer {
            0% { left: -100%; }
            100% { left: 100%; }
        }

        .math-header h1 {
            color: var(--primary-color);
            font-size: 3.2em;
            font-weight: 800;
            margin-bottom: 20px;
            text-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            font-family: 'Amiri', serif;
            position: relative;
        }

        .math-header .sub-header {
            font-size: 1.3em;
            color: #555;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 30px;
            font-weight: 600;
        }

        .math-header .sub-header span {
            padding: 12px 24px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: var(--border-radius-small);
            box-shadow: var(--shadow-soft);
            transition: var(--transition-fast);
        }

        .math-header .sub-header span:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-medium);
        }

        .exercises-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 40px;
            margin-bottom: 40px;
        }

        .exercise-card {
            background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
            border-radius: var(--border-radius);
            padding: 40px;
            box-shadow: var(--shadow-soft);
            border: 1px solid rgba(255, 255, 255, 0.8);
            transition: var(--transition);
            position: relative;
            overflow: hidden;
            transform: translateY(0);
        }

        .exercise-card:hover {
            transform: translateY(-8px) scale(1.02);
            box-shadow: var(--shadow-strong);
        }

        .exercise-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 6px;
            height: 100%;
            background: var(--gradient-primary);
            transition: var(--transition-fast);
        }

        .exercise-card:hover::before {
            width: 12px;
            box-shadow: var(--shadow-glow);
        }

        .exercise-header {
            display: flex;
            align-items: center;
            gap: 25px;
            margin-bottom: 30px;
            padding-bottom: 25px;
            border-bottom: 3px solid rgba(102, 126, 234, 0.1);
            position: relative;
        }

        .exercise-title {
            color: var(--primary-color);
            font-size: 1.8em;
            font-weight: 700;
            flex-grow: 1;
            font-family: 'Amiri', serif;
        }

        .exercise-number {
            background: var(--gradient-primary);
            color: white;
            padding: 12px 20px;
            border-radius: 50px;
            font-weight: 700;
            font-size: 1em;
            box-shadow: var(--shadow-soft);
            position: relative;
            overflow: hidden;
        }

        .exercise-number::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
            transition: var(--transition-fast);
        }

        .exercise-number:hover::before {
            left: 100%;
            transition: var(--transition-fast);
        }

        .exercise-content {
            color: #34495e;
            line-height: 2.2;
            margin-bottom: 30px;
            font-size: 1.1em;
        }

        .exercise-content p {
            margin-bottom: 18px;
        }

        .exercise-content ol, .exercise-content ul {
            padding-right: 25px;
            margin-bottom: 18px;
        }

        .exercise-content li {
            margin-bottom: 12px;
            position: relative;
            padding: 8px 0;
        }

        .exercise-content ol li::marker {
            color: var(--secondary-color);
            font-weight: 700;
        }

        .progress-stats {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
            padding: 20px;
            border-radius: var(--border-radius-small);
            margin: 30px 0;
            text-align: center;
            border: 2px solid rgba(102, 126, 234, 0.2);
            position: relative;
            overflow: hidden;
        }

        .progress-stats::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: var(--gradient-primary);
            background-size: 200% 100%;
            animation: progressGlow 2s ease-in-out infinite;
        }

        @keyframes progressGlow {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }

        .progress-indicator {
            display: flex;
            gap: 12px;
            justify-content: center;
            margin-bottom: 15px;
        }

        .progress-dot {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #e0e0e0;
            transition: var(--transition);
            position: relative;
            cursor: pointer;
        }

        .progress-dot::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.8);
            transition: var(--transition);
            transform: translate(-50%, -50%);
        }

        .progress-dot.active {
            background: var(--gradient-success);
            transform: scale(1.3);
            box-shadow: 0 0 20px rgba(79, 172, 254, 0.4);
        }

        .progress-dot.active::before {
            width: 8px;
            height: 8px;
        }

        .progress-dot.current {
            background: var(--gradient-warning);
            transform: scale(1.4);
            box-shadow: 0 0 25px rgba(250, 112, 154, 0.5);
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% {
                box-shadow: 0 0 25px rgba(250, 112, 154, 0.5);
            }
            50% {
                box-shadow: 0 0 35px rgba(250, 112, 154, 0.8);
                transform: scale(1.5);
            }
        }

        .progress-buttons {
            display: flex;
            gap: 20px;
            margin: 35px 0;
            flex-wrap: wrap;
            justify-content: center;
        }

        .progress-btn {
            font-family: 'Cairo', sans-serif;
            border: none;
            padding: 16px 32px;
            border-radius: 50px;
            cursor: pointer;
            font-size: 15px;
            font-weight: 700;
            transition: var(--transition);
            position: relative;
            overflow: hidden;
            min-width: 160px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            text-transform: none;
            box-shadow: var(--shadow-soft);
        }

        .progress-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
            transition: var(--transition);
        }

        .progress-btn:hover::before {
            left: 100%;
        }

        .progress-btn:disabled {
            opacity: 0.7;
            cursor: not-allowed;
            transform: none !important;
        }

        .progress-btn:not(:disabled):hover {
            transform: translateY(-4px) scale(1.05);
        }

        .btn-hint {
            background: var(--gradient-success);
            color: white;
            box-shadow: 0 8px 30px rgba(79, 172, 254, 0.4);
        }

        .btn-hint:hover:not(:disabled) {
            box-shadow: 0 15px 40px rgba(79, 172, 254, 0.6);
        }

        .btn-method {
            background: var(--gradient-warning);
            color: white;
            box-shadow: 0 8px 30px rgba(250, 112, 154, 0.4);
        }

        .btn-method:hover:not(:disabled) {
            box-shadow: 0 15px 40px rgba(250, 112, 154, 0.6);
        }

        .btn-solution {
            background: var(--gradient-info);
            color: white;
            box-shadow: 0 8px 30px rgba(155, 89, 182, 0.4);
        }

        .btn-solution:hover:not(:disabled) {
            box-shadow: 0 15px 40px rgba(155, 89, 182, 0.6);
        }

        .btn-reset {
            background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
            color: white;
            box-shadow: 0 8px 30px rgba(149, 165, 166, 0.4);
        }

        .btn-reset:hover:not(:disabled) {
            box-shadow: 0 15px 40px rgba(149, 165, 166, 0.6);
        }

        .correction-section {
            display: none !important;
            margin: 30px 0;
            padding: 35px;
            border-radius: var(--border-radius);
            position: relative;
            overflow: hidden;
            animation: sectionSlideIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            box-shadow: var(--shadow-medium);
            border: 2px solid transparent;
        }

        .correction-section.visible {
            display: block !important;
        }

        @keyframes sectionSlideIn {
            from { 
                opacity: 0; 
                transform: translateY(-30px) scale(0.9);
            }
            to { 
                opacity: 1; 
                transform: translateY(0) scale(1);
            }
        }

        .correction-section::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 8px;
            height: 100%;
            border-radius: 4px;
        }

        .correction-section::after {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            width: 100%;
            height: 4px;
            border-radius: 2px;
        }

        .correction-hint {
            background: linear-gradient(135deg, #e8f8f5 0%, #d1f2eb 100%);
            border-color: #27ae60;
            color: #0e6b3a;
        }

        .correction-hint::before {
            background: var(--gradient-success);
        }

        .correction-hint::after {
            background: var(--gradient-success);
        }

        .correction-hint h4 {
            color: #27ae60;
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
            font-size: 1.4em;
            font-weight: 700;
        }

        .correction-method {
            background: linear-gradient(135deg, #fef9e7 0%, #fcf4dd 100%);
            border-color: #f39c12;
            color: #b7950b;
        }

        .correction-method::before {
            background: var(--gradient-warning);
        }

        .correction-method::after {
            background: var(--gradient-warning);
        }

        .correction-method h4 {
            color: #f39c12;
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
            font-size: 1.4em;
            font-weight: 700;
        }

        .correction-solution {
            background: linear-gradient(135deg, #f4f3ff 0%, #e8e5ff 100%);
            border-color: #9b59b6;
            color: #6c3483;
        }

        .correction-solution::before {
            background: var(--gradient-info);
        }

        .correction-solution::after {
            background: var(--gradient-info);
        }

        .correction-solution h4 {
            color: #9b59b6;
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
            font-size: 1.4em;
            font-weight: 700;
        }

        .section-divider {
            text-align: center;
            margin: 80px 0 50px 0;
            padding: 30px;
            background: var(--gradient-primary);
            color: white;
            border-radius: var(--border-radius);
            font-size: 1.6em;
            font-weight: 800;
            box-shadow: var(--shadow-strong);
            position: relative;
            overflow: hidden;
            font-family: 'Amiri', serif;
        }

        .section-divider::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: 
                radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
            pointer-events: none;
        }

        .warning {
            background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
            color: #856404;
            padding: 20px;
            border-radius: var(--border-radius-small);
            border: 2px solid #f39c12;
            margin: 20px 0;
            position: relative;
            box-shadow: var(--shadow-soft);
        }

        .warning::before {
            content: '⚠️';
            position: absolute;
            top: 20px;
            right: 20px;
            font-size: 1.5em;
        }

        /* Enhanced Animations */
        .bounce-in {
            animation: bounceInAdvanced 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }

        @keyframes bounceInAdvanced {
            0% {
                transform: scale(0.3) rotate(-10deg);
                opacity: 0;
            }
            50% {
                transform: scale(1.08) rotate(2deg);
            }
            70% {
                transform: scale(0.95) rotate(-1deg);
            }
            100% {
                transform: scale(1) rotate(0deg);
                opacity: 1;
            }
        }

        .pulse-advanced {
            animation: pulseAdvanced 2s infinite;
        }

        @keyframes pulseAdvanced {
            0% {
                box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.5);
                transform: scale(1);
            }
            50% {
                box-shadow: 0 0 0 20px rgba(102, 126, 234, 0);
                transform: scale(1.05);
            }
            100% {
                box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
                transform: scale(1);
            }
        }

        /* Responsive Design */
        @media (max-width: 768px) {
            .math-container {
                padding: 30px 20px;
                margin: 10px;
            }
            
            .math-header h1 {
                font-size: 2.5em;
            }
            
            .math-header .sub-header {
                flex-direction: column;
                gap: 15px;
                padding: 0;
            }
            
            .progress-buttons {
                flex-direction: column;
                align-items: center;
            }
            
            .progress-btn {
                width: 100%;
                max-width: 280px;
            }
            
            .exercise-header {
                flex-direction: column;
                text-align: center;
                gap: 15px;
            }
            
            .correction-section {
                padding: 25px 20px;
            }
        }

        /* Advanced Scroll Effects */
        @media (prefers-reduced-motion: no-preference) {
            .exercise-card {
                opacity: 0;
                transform: translateY(30px);
                animation: fadeInUp 0.8s ease-out forwards;
            }
            
            .exercise-card:nth-child(1) { animation-delay: 0.1s; }
            .exercise-card:nth-child(2) { animation-delay: 0.2s; }
            .exercise-card:nth-child(3) { animation-delay: 0.3s; }
            .exercise-card:nth-child(4) { animation-delay: 0.4s; }
            .exercise-card:nth-child(5) { animation-delay: 0.5s; }
        }

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