 :root {
            --royal-purple: #1a0f4e;
            --royal-gold: #ffd700;
            --royal-gold-dark: #d4af37;
            --royal-gold-light: #fff9d6;
            --royal-blue: #0a0529;
            --royal-light: #4a3a8a;
            --royal-accent: #8a6de9;
            --royal-text: #f8f1ff;
            --royal-shadow: rgba(45, 27, 105, 0.7);
            --royal-dark: #0f0529;
            --royal-success: #4CAF50;
            --royal-warning: #FF9800;
            --royal-danger: #f44336;
        }

        * {
            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), #0c0635);
            color: var(--royal-text);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 20px;
            overflow-x: hidden;
        }

        /* Header */
        header {
            text-align: center;
            padding: 30px 20px;
            width: 100%;
            max-width: 1400px;
            margin-bottom: 20px;
            position: relative;
        }

        header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 80%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
            border-bottom: 2px solid var(--royal-gold);
        }

        .header-container h1 {
            font-size: 3.5rem;
            color: var(--royal-gold);
            text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
            margin-bottom: 10px;
            letter-spacing: 2px;
            position: relative;
        }

        .header-container span {
            color: var(--royal-accent);
        }

        .gradient-border {
            height: 3px;
            width: 80%;
            background: linear-gradient(90deg, transparent, var(--royal-gold), var(--royal-accent), var(--royal-gold), transparent);
            margin: 10px auto 0;
        }

        /* Settings Menu */
        #settings {
            position: fixed;
            top: 0;
            right: -400px;
            width: 350px;
            height: 100vh;
            background: radial-gradient(circle at center, rgba(26, 10, 82, 0.95), rgba(15, 5, 41, 0.98));
            border-left: 3px solid var(--royal-gold);
            z-index: 1000;
            transition: right 0.5s ease;
            box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
        }

        #settings.open {
            right: 0;
        }

        .menu-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            background: rgba(74, 58, 138, 0.3);
            border-bottom: 2px solid var(--royal-accent);
        }

        .menu-header h2 {
            color: var(--royal-gold);
            font-size: 1.8rem;
        }

        #close-menu {
            color: var(--royal-gold);
            font-size: 1.5rem;
            cursor: pointer;
            transition: transform 0.3s;
            padding: 10px;
        }

        #close-menu:hover {
            transform: rotate(90deg);
            color: var(--royal-accent);
        }

        .settings-container {
            padding: 20px;
        }

        .settings-container > div {
            margin-bottom: 20px;
        }

        .settings-container p {
            color: var(--royal-gold);
            margin-bottom: 8px;
            font-size: 1.1rem;
        }

        .settings-container input {
            width: 100%;
            padding: 12px 15px;
            border-radius: 10px;
            border: 2px solid var(--royal-gold);
            background: rgba(255, 255, 255, 0.1);
            color: var(--royal-text);
            font-size: 1rem;
            transition: all 0.3s;
        }

        .settings-container input:focus {
            outline: none;
            border-color: var(--royal-accent);
            box-shadow: 0 0 15px rgba(138, 109, 233, 0.5);
        }

        #save-settings {
            width: 100%;
            padding: 14px;
            background: linear-gradient(145deg, var(--royal-success), #2E7D32);
            border: none;
            border-radius: 10px;
            color: white;
            font-weight: bold;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 20px;
        }

        #save-settings:hover {
            background: linear-gradient(145deg, #66BB6A, #388E3C);
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
        }

        /* Main Container */
        main {
            width: 100%;
            max-width: 1400px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 30px;
        }

        /* Linked List Visualization Area */
        .list {
            width: 100%;
            min-height: 300px;
            background: radial-gradient(circle at center, rgba(26, 10, 82, 0.7), rgba(15, 5, 41, 0.8));
            border: 3px solid var(--royal-accent);
            border-radius: 20px;
            padding: 30px;
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            gap: 20px;
            position: relative;
            overflow: auto;
            box-shadow: 
                0 0 40px rgba(138, 109, 233, 0.3),
                inset 0 0 40px rgba(255, 215, 0, 0.05);
        }

        /* Linked List Node */
        .node {
            display: flex;
            align-items: center;
            position: relative;
            animation: nodeAppear 0.5s ease-out;
        }

        .node-data {
            width: 100px;
            height: 100px;
            background: linear-gradient(145deg, var(--royal-gold), var(--royal-gold-dark));
            border-radius: 15px;
            color: var(--royal-blue);
            font-weight: bold;
            font-size: 1.8rem;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            box-shadow: 
                0 8px 20px rgba(0, 0, 0, 0.3),
                inset 0 2px 5px rgba(255, 255, 255, 0.4),
                0 5px 0 rgba(212, 175, 55, 0.7);
            border: 3px solid rgba(212, 175, 55, 0.8);
            z-index: 2;
        }

        .node-data::before {
            content: '';
            position: absolute;
            top: 8px;
            left: 8px;
            right: 8px;
            height: 15px;
            background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
            border-radius: 8px;
        }

        .node-pointer {
            display: flex;
            align-items: center;
            color: var(--royal-accent);
            font-size: 2rem;
            margin: 0 15px;
            position: relative;
            z-index: 1;
        }

        .node-pointer i {
            text-shadow: 0 0 10px rgba(138, 109, 233, 0.7);
        }

        .null-pointer {
            width: 100px;
            height: 100px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #b5a8ff;
            font-style: italic;
            border: 2px dashed var(--royal-accent);
            font-size: 1.2rem;
        }

        .node-index {
            position: absolute;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(26, 10, 82, 0.9);
            color: var(--royal-gold-light);
            padding: 5px 15px;
            border-radius: 10px;
            font-size: 0.9rem;
            border: 1px solid var(--royal-accent);
        }

        .node.highlight {
            animation: highlightNode 1s ease-in-out infinite alternate;
        }

        .node-pointer.highlight {
            animation: highlightPointer 1s ease-in-out infinite alternate;
        }

        @keyframes nodeAppear {
            0% {
                transform: scale(0.5);
                opacity: 0;
            }
            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        @keyframes highlightNode {
            0% {
                transform: scale(1);
                box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
            }
            100% {
                transform: scale(1.05);
                box-shadow: 0 0 30px rgba(255, 215, 0, 0.7);
            }
        }

        @keyframes highlightPointer {
            0% {
                transform: translateX(0);
                color: var(--royal-accent);
            }
            100% {
                transform: translateX(5px);
                color: var(--royal-gold);
            }
        }

        /* Error Messages */
        .errors {
            width: 100%;
            text-align: center;
        }

        .error-message {
            background: rgba(244, 67, 54, 0.1);
            border: 2px solid var(--royal-danger);
            border-radius: 10px;
            padding: 15px;
            color: #ffb3b3;
            font-size: 1.1rem;
            display: none;
        }

        .error-message.show {
            display: block;
            animation: shake 0.5s ease;
        }

        .success {
            background: rgba(76, 175, 80, 0.1);
            border: 2px solid var(--royal-success);
            border-radius: 10px;
            padding: 15px;
            color: #c8e6c9;
            font-size: 1.1rem;
            display: none;
        }

        .success.show {
            display: block;
        }

        /* Operations Panel */
        .operations {
            width: 100%;
            background: radial-gradient(circle at center, rgba(26, 10, 82, 0.9), rgba(15, 5, 41, 0.95));
            border: 3px solid var(--royal-gold);
            border-radius: 20px;
            padding: 30px;
            box-shadow: 
                0 0 40px rgba(138, 109, 233, 0.5),
                inset 0 0 40px rgba(255, 215, 0, 0.1);
        }

        .wrapper {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 25px;
        }

        .operations > div {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .operations input {
            padding: 14px 20px;
            border-radius: 10px;
            border: 2px solid var(--royal-gold);
            background: rgba(255, 255, 255, 0.1);
            color: var(--royal-text);
            font-size: 1.1rem;
            transition: all 0.3s;
            box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
        }

        .operations input:focus {
            outline: none;
            border-color: var(--royal-accent);
            box-shadow: 0 0 15px rgba(138, 109, 233, 0.5);
            background: rgba(255, 255, 255, 0.15);
        }

        .operations input::placeholder {
            color: #b5a8ff;
        }

        .button {
            padding: 14px 28px;
            border-radius: 10px;
            border: none;
            color: white;
            font-weight: bold;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            min-width: 140px;
            background: linear-gradient(145deg, var(--royal-accent), #6b4dcc);
        }

        .button:hover {
            background: linear-gradient(145deg, #9b7fff, var(--royal-accent));
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
        }

        .remove {
            display: flex;
            gap: 10px;
        }

        .remove-option {
            display: none;
            padding: 10px 20px;
            background: rgba(74, 58, 138, 0.5);
            border: 1px solid var(--royal-accent);
            color: var(--royal-text);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .remove-option.show {
            display: inline-block;
        }

        .remove-option:hover {
            background: rgba(138, 109, 233, 0.3);
        }

        /* Settings Button */
        #settings-btn {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 999;
            background: linear-gradient(145deg, var(--royal-accent), #6b4dcc);
            border: none;
            border-radius: 10px;
            color: white;
            padding: 12px 20px;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            display: flex;
            align-items: center;
            gap: 10px;
        }

        #settings-btn:hover {
            background: linear-gradient(145deg, #9b7fff, var(--royal-accent));
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
        }

        /* Footer */
        .footer {
            margin-top: 40px;
            text-align: center;
            color: #b5a8ff;
            font-size: 1rem;
            padding: 25px;
            width: 100%;
            max-width: 1400px;
            border-top: 1px solid rgba(255, 215, 0, 0.3);
            background: rgba(15, 5, 41, 0.5);
            border-radius: 15px;
        }

        /* Animation for shake */
        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
            20%, 40%, 60%, 80% { transform: translateX(5px); }
        }

        /* Responsive Design */
        @media (max-width: 1200px) {
            .header-container h1 {
                font-size: 3rem;
            }
            
            .node-data {
                width: 90px;
                height: 90px;
                font-size: 1.6rem;
            }
            
            .null-pointer {
                width: 90px;
                height: 90px;
            }
        }

        @media (max-width: 768px) {
            .header-container h1 {
                font-size: 2.5rem;
            }
            
            .wrapper {
                grid-template-columns: 1fr;
            }
            
            .node {
                flex-direction: column;
                margin-bottom: 30px;
            }
            
            .node-pointer {
                transform: rotate(90deg);
                margin: 15px 0;
            }
            
            .node-index {
                top: -25px;
            }
            
            #settings {
                width: 100%;
                right: -100%;
            }
        }

        @media (max-width: 480px) {
            .header-container h1 {
                font-size: 2rem;
            }
            
            .node-data {
                width: 80px;
                height: 80px;
                font-size: 1.4rem;
            }
            
            .null-pointer {
                width: 80px;
                height: 80px;
                font-size: 1rem;
            }
            
            .operations input, .button {
                width: 100%;
            }
        }

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

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

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

        ::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(var(--royal-gold-light), var(--royal-accent-light));
        }