.diagram-shell {
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background:
        linear-gradient(135deg, rgba(140, 82, 255, 0.08), rgba(0, 255, 159, 0.08)),
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.88));
    border-radius: 1.25rem;
    box-shadow: 0 24px 60px -36px rgba(15, 23, 42, 0.45);
}

.diagram-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.diagram-content {
    position: relative;
    z-index: 1;
}

.diagram-node {
    border: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 0.875rem;
    color: #0f172a;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.diagram-node:hover,
.diagram-node.is-active {
    transform: translateY(-3px);
    border-color: rgba(140, 82, 255, 0.55);
    background: #ffffff;
    box-shadow: 0 18px 36px -26px rgba(140, 82, 255, 0.8);
}

.diagram-node.is-active .diagram-dot {
    background: #00ff9f;
    box-shadow: 0 0 0 7px rgba(0, 255, 159, 0.18);
}

.diagram-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 999px;
    background: #8c52ff;
    flex: 0 0 auto;
    transition: background 180ms ease, box-shadow 180ms ease;
}

.diagram-connector {
    height: 2px;
    background: linear-gradient(90deg, rgba(140, 82, 255, 0.25), rgba(0, 255, 159, 0.75));
    position: relative;
    overflow: hidden;
}

.diagram-connector::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 34%;
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
    animation: diagram-scan 2.4s linear infinite;
}

.diagram-detail {
    border: 1px solid rgba(140, 82, 255, 0.2);
    background: rgba(255, 255, 255, 0.78);
    border-radius: 1rem;
    min-height: 8.5rem;
}

.diagram-detail [data-detail-panel] {
    display: none;
}

.diagram-detail [data-detail-panel].is-active {
    display: block;
    animation: diagram-fade 220ms ease;
}

.diagram-chip {
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.4rem 0.7rem;
}

.diagram-bar {
    height: 0.55rem;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.diagram-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8c52ff, #00ff9f);
    transition: width 220ms ease;
}

.diagram-center {
    border: 1px solid rgba(140, 82, 255, 0.25);
    background: #0f172a;
    color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 20px 50px -30px rgba(15, 23, 42, 0.7);
}

@keyframes diagram-scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(320%); }
}

@keyframes diagram-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .diagram-connector::after,
    .diagram-detail [data-detail-panel].is-active {
        animation: none;
    }

    .diagram-node {
        transition: none;
    }
}
