:root {
    --c-bg: #0a0a0a;
    --c-text: #e5e5e5;
    --c-muted: #9ca3af;
    --c-border: rgba(255, 255, 255, 0.05);
    --c-primary: #a855f7;
    --c-primary-light: #d4a9ff;
    --c-primary-glow: #e0b3ff;
    --c-primary-bg: rgba(168, 85, 247, 0.15);
    --c-accent: #3b82f6;
    --c-accent-light: #60a5fa;
    --c-danger: #ff4444;
    --c-danger-glow: #ff3399;
    --glow-sm: 0 0 10px;
    --glow-md: 0 0 20px;
    --glow-lg: 0 0 40px;
    --glow-xl: 0 0 80px;
}

body {
    background: var(--c-bg);
    color: var(--c-text);
    min-height: 100vh;
    font-family: system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
}

/* Animated Mesh Gradient */
.liquid-bg-element {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: floatLiquid 20s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #a855f7;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #00FF94;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: #3b82f6;
    animation-delay: -10s;
}

@keyframes floatLiquid {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* Liquid Glass Surface */
.liquid-glass-panel {
    background: rgba(17, 25, 40, 0.6) !important;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.125);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05), 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Optical Borders for Inputs & Buttons */
input,
button.bg-ngl-dark,
.bg-ngl-dark {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
    border-right: 1px solid rgba(0, 0, 0, 0.4);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
}

/* Custom Liquid Scrollbar */
    ::-webkit-scrollbar {
        width: 10px;
        background: transparent;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        border: 2px solid transparent;
        background-clip: content-box;
        backdrop-filter: blur(10px);
    }

    ::-webkit-scrollbar-thumb:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }

    .no-scrollbar::-webkit-scrollbar {
        display: none;
    }

    .no-scrollbar {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(12px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes fadeOut {
        from {
            opacity: 1;
            transform: scale(1);
        }

        to {
            opacity: 0;
            transform: scale(0.92);
        }
    }

    @keyframes pulseGlow {

        0%,
        100% {
            opacity: 0.8;
        }

        50% {
            opacity: 1;
        }
    }

    .animate-fade-in {
        animation: fadeIn 0.35s ease-out forwards;
    }

    .animate-fade-out {
        animation: fadeOut 0.3s ease-out forwards;
    }

    .delay-100 {
        animation-delay: 100ms;
    }

    .delay-200 {
        animation-delay: 200ms;
    }


    .neon-glow {
        box-shadow:
            var(--glow-sm) var(--c-primary),
            var(--glow-md) var(--c-primary-light),
            var(--glow-lg) rgba(224, 179, 255, 0.4);
        transition: all 0.3s ease;
    }

    .neon-glow:hover {
        box-shadow:
            var(--glow-md) var(--c-primary-light),
            var(--glow-lg) var(--c-primary-glow),
            var(--glow-xl) rgba(224, 179, 255, 0.5);
        transform: translateY(-2px);
    }

    .text-neon {
        text-shadow:
            0 0 8px var(--c-primary),
            0 0 16px var(--c-primary-light),
            0 0 24px var(--c-primary-glow);
    }

    .text-neon-blue {
        text-shadow:
            0 0 8px var(--c-accent),
            0 0 16px var(--c-accent-light),
            0 0 24px #93c5fd;
    }


    #cancel-reply-btn {
        font-size: 1.25rem;
        line-height: 1;
    }

    .reply-quote-container {
        display: none;
    }

    .msg-item.is-me {
        align-self: flex-end;
        flex-direction: row-reverse;
        --tw-space-x-reverse: 1;
    }

    .is-me .chain-line {
        left: auto;
        right: 1.15rem;
    }

    .is-me .reply-btn {
        left: 3rem;
        right: auto;
    }

    .is-me .react-btn {
        left: 0.5rem;
        right: auto;
    }

    .is-me .reaction-palette {
        left: 0.5rem;
        right: auto;
    }

    .is-me .edit-btn {
        left: 5.5rem;
        right: auto;
    }

    .is-me .delete-btn {
        left: 8rem;
        right: auto;
    }

    .is-me .delete-btn:hover {
        color: var(--c-danger);
        text-shadow: 0 0 10px var(--c-danger);
    }


    .msg-item:hover .username,
    .is-me .username {
        color: var(--c-primary-light);
        text-shadow: 0 0 12px var(--c-primary-glow);
        transition: all 0.3s ease;
    }

    .msg-item .username {
        cursor: copy;
    }


    #chain-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(168, 85, 247, 0.4);
        border-right: 1px solid rgba(164, 94, 230, 0.349);
        backdrop-filter: blur(10px);
    }

    .sidebar-tab {
        color: var(--c-muted);
        border-bottom: 2px solid transparent;
        transition: all 0.25s ease;
        width: 33.33%;
    }

    .sidebar-tab:hover {
        background-color: #1f2937;
    }

    .sidebar-tab.active {
        color: #ffffff;
        background-color: rgba(168, 85, 247, 0.15);
        border-bottom: 3px solid var(--c-primary-light);
        text-shadow: 0 0 15px var(--c-primary-glow);
        box-shadow: 0 -6px 20px rgba(168, 85, 247, 0.4);
    }

    .chain-list li {
        display: flex;
        align-items: center;
        border-bottom: 1px solid var(--c-border);
        position: relative;
    }

    .chain-list a {
        display: flex;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        color: var(--c-muted);
        text-decoration: none;
        flex-grow: 1;
        transition: all 0.25s ease;
        position: relative;
        overflow: hidden;
    }

    .chain-list a:hover {
        background-color: rgba(168, 85, 247, 0.1);
        color: #e0b3ff;
    }

    .chain-list a.active {
        background-color: var(--c-primary-bg);
        color: #e0b3ff;
        font-weight: 700;
        text-shadow:
            0 0 8px var(--c-primary),
            0 0 16px var(--c-primary-light),
            0 0 24px var(--c-primary-glow);
        border-left: 4px solid var(--c-primary-light);
        box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.3);
        animation: pulseGlow 4s infinite alternate;
    }

    .chain-list a.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(180deg, #a855f7, #ec4899);
        box-shadow: 0 0 15px #c89af7;
    }

    .chain-list-item .peer-count {
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.7rem;
        padding: 3px 8px;
        border-radius: 9999px;
        background: #262626;
        color: #6b7280;
    }

    .chain-list-item .peer-count.active {
        background: linear-gradient(135deg, #a855f7, #ec4899);
        color: #ffffff;
        font-weight: 900;
        box-shadow: 0 0 20px rgba(236, 72, 153, 0.7);
        animation: pulseGlow 3s infinite;
    }

    .chain-list-delete-btn {
        padding: 0.75rem 1rem;
        color: #6b7280;
        background: none;
        border: none;
        cursor: pointer;
        transition: all 0.25s ease;
    }

    .chain-list-delete-btn:hover {
        color: var(--c-danger-glow);
        text-shadow: 0 0 12px var(--c-danger-glow);
    }

    .chain-list-delete-btn.is-remove:hover {
        color: #9ca3af;
    }

    .reply-btn:hover,
    .react-btn:hover,
    .edit-btn:hover {
        color: var(--c-primary-light);
        text-shadow: 0 0 12px var(--c-primary-glow);
        transform: scale(1.1);
        transition: all 0.2s ease;
    }