  :root {
            --royal-purple: #2d1b69;
            --royal-gold: #ffd700;
            --royal-blue: #1a0a52;
            --royal-light: #4a3a8a;
            --royal-accent: #8a6de9;
            --royal-text: #f8f1ff;
            --royal-shadow: rgba(45, 27, 105, 0.5);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, var(--royal-blue), var(--royal-purple));
            color: var(--royal-text);
            min-height: 100vh;
            display: flex;
            overflow-x: hidden;
        }

        /* Decorative elements */
        .crown {
            position: absolute;
            top: 10px;
            left: 10px;
            font-size: 24px;
            color: var(--royal-gold);
            z-index: 10;
        }

        .header {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
            z-index: 10;
            width: 100%;
        }

        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 5px;
            color: var(--royal-gold);
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        }

        .header h2 {
            font-size: 1.2rem;
            color: #d0c0ff;
            font-weight: normal;
        }

        .left {
            width: 25%;
            padding: 90px 20px 20px;
            background: rgba(26, 10, 82, 0.7);
            border-right: 3px solid var(--royal-gold);
            box-shadow: 5px 0 15px var(--royal-shadow);
            overflow-y: auto;
            height: 100vh;
            position: relative;
            z-index: 2;
        }

        .left h3 {
            text-align: center;
            margin-bottom: 25px;
            font-size: 1.8rem;
            color: var(--royal-gold);
            border-bottom: 2px solid var(--royal-accent);
            padding-bottom: 10px;
        }

        .product-box {
            background: linear-gradient(145deg, var(--royal-light), var(--royal-purple));
            border: 2px solid var(--royal-gold);
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            position: relative;
            overflow: hidden;
        }

        .product-box:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
            border-color: #fff;
        }

        .product-box::after {
            content: '';
            position: absolute;
            top: -10px;
            right: -10px;
            width: 30px;
            height: 30px;
            background-color: var(--royal-gold);
            border-radius: 50%;
            opacity: 0.3;
        }

        .product-box img {
            width: 60px;
            height: 60px;
            object-fit: cover;
            border-radius: 8px;
            border: 2px solid var(--royal-accent);
            margin-right: 15px;
        }

        .product-box h3 {
            font-size: 1.3rem;
            color: white;
            margin: 0;
            border: none;
        }

        .right {
            width: 75%;
            padding: 90px 30px 30px;
            overflow-y: auto;
            height: 100vh;
            position: relative;
        }

        .top-Text {
            background: linear-gradient(90deg, var(--royal-purple), var(--royal-accent));
            padding: 15px;
            border-radius: 10px;
            text-align: center;
            font-size: 1.4rem;
            margin-bottom: 30px;
            border: 2px solid var(--royal-gold);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            color: var(--royal-gold);
        }

        .right-box {
            background: rgba(26, 10, 82, 0.8);
            border-radius: 15px;
            padding: 25px;
            margin-bottom: 30px;
            border: 2px solid var(--royal-accent);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
            display: none;
        }

        .right-box.active {
            display: block;
            animation: fadeIn 0.5s ease;
        }

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

        .right-box h2 {
            color: var(--royal-gold);
            font-size: 2.2rem;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid var(--royal-accent);
            display: flex;
            align-items: center;
        }

        .right-box h2::before {
            content: '👑';
            margin-right: 10px;
            font-size: 1.8rem;
        }

        /* Complexity boxes */
        .complexity-container {
            display: flex;
            gap: 15px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .complexity-box {
            background: rgba(138, 109, 233, 0.2);
            padding: 12px 20px;
            border-radius: 8px;
            border-left: 5px solid var(--royal-gold);
            font-weight: bold;
            flex: 1;
            min-width: 200px;
            display: flex;
            align-items: center;
        }

        .complexity-box i {
            margin-right: 10px;
            color: var(--royal-gold);
            font-size: 1.2rem;
        }

        /* Stats Container */
        .stats-container {
            display: flex;
            justify-content: space-between;
            background: rgba(74, 58, 138, 0.5);
            padding: 15px;
            border-radius: 10px;
            margin-bottom: 20px;
            border: 2px solid var(--royal-accent);
        }

        .stat-box {
            text-align: center;
            flex: 1;
        }

        .stat-value {
            font-size: 2rem;
            font-weight: bold;
            color: var(--royal-gold);
        }

        .stat-label {
            font-size: 0.9rem;
            color: #d0c0ff;
        }

        /* Array Visualization */
        .array-container {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
            background: rgba(26, 10, 82, 0.9);
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 25px;
            border: 2px solid var(--royal-accent);
            min-height: 100px;
        }

        .array-element {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            font-weight: bold;
            border-radius: 8px;
            background: linear-gradient(145deg, var(--royal-accent), #6b4dcc);
            color: white;
            border: 2px solid transparent;
            transition: all 0.3s ease;
            position: relative;
        }

        .array-element.comparing {
            background: linear-gradient(145deg, #ff6b9d, #ff4081);
            border-color: pink;
            transform: scale(1.1);
            box-shadow: 0 0 15px rgba(255, 105, 180, 0.7);
        }

        .array-element.swapping {
            background: linear-gradient(145deg, #c19a6b, #8b4513);
            border-color: #d2691e;
            transform: scale(1.1);
            box-shadow: 0 0 15px rgba(139, 69, 19, 0.7);
        }

        .array-element.sorted {
            background: linear-gradient(145deg, #4CAF50, #2E7D32);
            border-color: #81C784;
        }

        .array-element.pivot {
            background: linear-gradient(145deg, #FF9800, #F57C00);
            border-color: #FFB74D;
            transform: scale(1.1);
            box-shadow: 0 0 15px rgba(255, 152, 0, 0.7);
        }

        .array-element.current {
            background: linear-gradient(145deg, #2196F3, #0D47A1);
            border-color: #64B5F6;
        }

        /* Bar Visualization */
        .bar-container {
            height: 250px;
            background: rgba(26, 10, 82, 0.9);
            border-radius: 10px;
            padding: 20px;
            display: flex;
            align-items: flex-end;
            justify-content: center;
            gap: 5px;
            margin-bottom: 25px;
            border: 2px solid var(--royal-accent);
        }

        .bar {
            background: linear-gradient(to top, var(--royal-accent), #6b4dcc);
            width: 40px;
            border-radius: 5px 5px 0 0;
            transition: height 0.3s, background-color 0.3s;
            position: relative;
            box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.2);
        }

        .bar.comparing {
            background: linear-gradient(to top, pink, #ff66b2);
        }

        .bar.swapping {
            background: linear-gradient(to top, brown, #8b4513);
        }

        .bar.sorted {
            background: linear-gradient(to top, #4CAF50, #2E7D32);
        }

        .bar.pivot {
            background: linear-gradient(to top, #FF9800, #F57C00);
        }

        .bar.current {
            background: linear-gradient(to top, #2196F3, #0D47A1);
        }

        .bar-value {
            position: absolute;
            top: -25px;
            left: 50%;
            transform: translateX(-50%);
            font-weight: bold;
            color: white;
        }

        /* Controls */
        .controls-container {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: center;
            background: rgba(74, 58, 138, 0.5);
            padding: 20px;
            border-radius: 10px;
            margin-bottom: 20px;
            border: 2px solid var(--royal-accent);
        }

        .input-group {
            flex-grow: 1;
            display: flex;
            align-items: center;
        }

        .input-group input[type="text"] {
            flex-grow: 1;
            padding: 12px 15px;
            border-radius: 8px;
            border: 2px solid var(--royal-accent);
            background: rgba(255, 255, 255, 0.1);
            color: white;
            font-size: 1rem;
        }

        .input-group input[type="text"]::placeholder {
            color: #c5b3ff;
        }

        .btn-group {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .btn {
            padding: 12px 25px;
            border-radius: 8px;
            border: none;
            background: linear-gradient(145deg, var(--royal-gold), #e6c300);
            color: var(--royal-blue);
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .btn:hover {
            background: linear-gradient(145deg, #fff, var(--royal-gold));
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
        }

        .btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .btn-secondary {
            background: linear-gradient(145deg, var(--royal-accent), #6b4dcc);
            color: white;
        }

        .btn-secondary:hover {
            background: linear-gradient(145deg, #9b7fff, var(--royal-accent));
        }

        .speed-control {
            display: flex;
            align-items: center;
            gap: 10px;
            background: rgba(138, 109, 233, 0.2);
            padding: 10px 15px;
            border-radius: 8px;
        }

        .speed-control label {
            color: var(--royal-gold);
            font-weight: bold;
            white-space: nowrap;
        }

        .speed-control input[type="range"] {
            width: 150px;
            height: 8px;
            border-radius: 4px;
            background: var(--royal-light);
            outline: none;
        }

        /* Algorithm Display */
        .algorithm-container {
            display: flex;
            gap: 20px;
            margin-top: 20px;
        }

        .algorithm-code {
            flex: 1;
            background: rgba(26, 10, 82, 0.9);
            border-radius: 10px;
            padding: 20px;
            border: 2px solid var(--royal-accent);
            overflow: auto;
            max-height: 400px;
        }

        .algorithm-code pre {
            margin: 0;
            color: #f8f8f2;
        }

        .algorithm-code code {
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .algorithm-explanation {
            flex: 1;
            background: rgba(74, 58, 138, 0.5);
            border-radius: 10px;
            padding: 20px;
            border: 2px solid var(--royal-accent);
        }

        .algorithm-explanation h3 {
            color: var(--royal-gold);
            margin-bottom: 15px;
            border-bottom: 2px solid var(--royal-accent);
            padding-bottom: 8px;
        }

        .algorithm-explanation p {
            margin-bottom: 15px;
            line-height: 1.6;
        }

        .algorithm-explanation ul {
            padding-left: 20px;
            margin-bottom: 15px;
        }

        .algorithm-explanation li {
            margin-bottom: 8px;
        }

        /* Legend */
        .legend-container {
            display: flex;
            justify-content: center;
            gap: 20px;
            flex-wrap: wrap;
            margin-top: 20px;
            padding: 15px;
            background: rgba(74, 58, 138, 0.5);
            border-radius: 10px;
            border: 2px solid var(--royal-accent);
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .legend-color {
            width: 20px;
            height: 20px;
            border-radius: 4px;
            border: 2px solid white;
        }

        /* Responsive design */
        @media (max-width: 1200px) {
            .left, .right {
                width: 100%;
                height: auto;
                min-height: 100vh;
            }
            
            .left {
                border-right: none;
                border-bottom: 3px solid var(--royal-gold);
                height: auto;
                min-height: auto;
            }
            
            body {
                flex-direction: column;
            }
            
            .algorithm-container {
                flex-direction: column;
            }
        }

        @media (max-width: 768px) {
            .header h1 {
                font-size: 1.8rem;
            }
            
            .product-box {
                flex-direction: column;
                text-align: center;
            }
            
            .product-box img {
                margin-right: 0;
                margin-bottom: 10px;
            }
            
            .controls-container {
                flex-direction: column;
                align-items: stretch;
            }
            
            .btn-group {
                justify-content: center;
            }
            
            .array-element {
                width: 45px;
                height: 45px;
                font-size: 1.2rem;
            }
            
            .stat-value {
                font-size: 1.5rem;
            }
        }

        /* Scrollbar styling */
        ::-webkit-scrollbar {
            width: 10px;
        }

        ::-webkit-scrollbar-track {
            background: var(--royal-blue);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--royal-accent);
            border-radius: 5px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--royal-gold);
        }

        /* Code highlighting */
        .keyword {
            color: #ff79c6;
        }
        .function {
            color: #50fa7b;
        }
        .variable {
            color: #8be9fd;
        }
        .comment {
            color: #6272a4;
        }
        .string {
            color: #f1fa8c;
        }