:root {
    --primary: #3b82f6;
    --accent: #ef4444;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-muted: #94a3b8;
}

body {
    background: #020617;
    color: #fff;
    padding: 40px 20px;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
    position: relative;
}

.bg-fx {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 50%, rgba(37, 99, 235, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(239, 68, 68, 0.08), transparent 25%);
    animation: pulse-bg 10s ease-in-out infinite alternate;
}

@keyframes pulse-bg {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

h1 {
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 3.5rem;
    margin-bottom: 80px;
    text-align: center;
    font-weight: 800;
    letter-spacing: -1px;
    text-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.viz-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 120px;
    flex-wrap: wrap;
    margin-bottom: 120px;
    position: relative;
}

.viz-container::after {
    content: '➔';
    font-size: 3rem;
    color: #ffffff;
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    opacity: 0.5;
    animation: slide-arrow 2s infinite ease-in-out;
}

@keyframes slide-arrow {

    0%,
    100% {
        transform: translate(-50%, -50%) translateX(-10px);
    }

    50% {
        transform: translate(-50%, -50%) translateX(10px);
    }
}

@media (max-width: 900px) {
    .viz-container::after {
        content: '↓';
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        animation: slide-arrow-vert 2s infinite ease-in-out;
    }

    @keyframes slide-arrow-vert {

        0%,
        100% {
            transform: translate(-50%, -50%) translateY(-10px);
        }

        50% {
            transform: translate(-50%, -50%) translateY(10px);
        }
    }

    .viz-container {
        gap: 80px;
    }
}

.sphere-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    z-index: 1;
}

.caption {
    font-size: 1.2rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 600;
    position: relative;
}

.caption.highlight {
    color: #60a5fa;
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.5);
}

.sphere {
    width: 320px;
    height: 320px;
    border-radius: 50%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

/* PROBLEM SPHERE (LEFT) */
.problem-sphere {
    background: radial-gradient(circle at 40% 40%, rgba(51, 65, 85, 0.8), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow:
        0 0 0 1px rgba(239, 68, 68, 0.1),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    overflow: visible;
    touch-action: none;
}

.problem-sphere:hover {
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.6);
}

.problem-node {
    position: absolute;
    width: 80px;
    height: 80px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.75rem;
    padding: 8px;
    color: #fca5a5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    cursor: grab;
    user-select: none;
    transform-origin: center center;
    will-change: transform;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.problem-node:active {
    cursor: grabbing;
}

/* Selected State - Reddish Glassmorphism */
.problem-node.selected {
    background: rgba(239, 68, 68, 0.25);
    /* Reddish glass */
    border-color: #ef4444;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.5);
    z-index: 50;
    /* Ensure on top */
    backdrop-filter: blur(8px);
}

/* Popup Styles */
.node-popup {
    position: absolute;
    width: 200px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #ef4444;
    padding: 15px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #fff;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(10px) scale(0.9);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.node-popup.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.node-popup h4 {
    margin: 0 0 8px 0;
    color: #fca5a5;
    font-size: 0.95rem;
}

.node-popup h4::before {
    display: none;
}

.node-popup p {
    margin: 0;
    line-height: 1.4;
    color: #cbd5f5;
}

/* SOLUTION SPHERE (RIGHT) */
.solution-sphere {
    background: radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.2), rgba(30, 58, 138, 0.4));
    border: 1px solid rgba(96, 165, 250, 0.5);
    box-shadow:
        0 0 60px rgba(37, 99, 235, 0.2),
        inset 0 0 60px rgba(37, 99, 235, 0.1);
    animation: breathe 5s infinite ease-in-out;
    z-index: 2;
    text-align: center;
}

@keyframes breathe {

    0%,
    100% {
        box-shadow: 0 0 60px rgba(37, 99, 235, 0.2), inset 0 0 60px rgba(37, 99, 235, 0.1);
    }

    50% {
        box-shadow: 0 0 100px rgba(37, 99, 235, 0.4), inset 0 0 100px rgba(37, 99, 235, 0.2);
    }
}

.solution-content h2 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 5px;
    font-weight: 700;
}

.solution-content p {
    color: #93c5fd;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.roadmap-section {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 80px;
    margin-top: 80px;
    text-align: center;
}

.roadmap-section h2 {
    font-size: 2.5rem;
    margin-bottom: 60px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.flow-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

.flow-row {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 100px;
    position: relative;
    flex-wrap: wrap;
    width: 100%;
}

.flow-node {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 24px 32px;
    border-radius: 16px;
    text-align: center;
    min-width: 240px;
    position: relative;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 2;
    transition: transform 0.3s;
    animation: fade-up 1s ease-out backwards;
}

.flow-node:hover {
    transform: translateY(-5px);
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.flow-row:nth-child(1) .flow-node {
    animation-delay: 0.2s;
}

.flow-row:nth-child(2) .flow-node {
    animation-delay: 0.4s;
}

.flow-row:nth-child(3) .flow-node {
    animation-delay: 0.6s;
}

.flow-row:nth-child(4) .flow-node {
    animation-delay: 0.8s;
}

.flow-row:nth-child(5) .flow-node {
    animation-delay: 1.0s;
}

.flow-row:nth-child(6) .flow-node {
    animation-delay: 1.2s;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flow-node h3 {
    color: #fff;
    margin: 0 0 10px 0;
    font-size: 1.3rem;
    font-weight: 600;
    text-shadow: none;
}

.flow-node p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

.flow-node.highlight {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(37, 99, 235, 0.1);
    box-shadow: 0 0 40px rgba(37, 99, 235, 0.1);
}

.flow-node.highlight h3 {
    color: #60a5fa;
}

.flow-node::after {
    content: '';
    position: absolute;
    bottom: -102px;
    left: 50%;
    width: 1px;
    height: 100px;
    background: linear-gradient(to bottom, #475569 85%, transparent);
    transform: translateX(-50%);
    z-index: 1;
}

.flow-node::before {
    content: '';
    position: absolute;
    bottom: -108px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #475569;
    z-index: 1;
    animation: fade-in 1.5s ease-out backwards;
}

.flow-row:last-child .flow-node::after,
.flow-row:last-child .flow-node::before {
    display: none;
}

.flow-connector-horz {
    position: absolute;
    top: -50px;
    left: 50%;
    width: 360px;
    height: 1px;
    background: #475569;
    transform: translateX(-50%);
    z-index: 1;
}

.flow-split-root::after {
    height: 50px !important;
    bottom: -50px !important;
    background: #475569 !important;
}

.flow-split-root::before {
    display: none;
}

.branch-node .up-line {
    position: absolute;
    top: -50px;
    left: 50%;
    width: 1px;
    height: 50px;
    background: #475569;
    transform: translateX(-50%);
}

.branch-node .arrow-in {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #475569;
}

.join-connector {
    position: absolute;
    top: -50px;
    left: 50%;
    width: 300px;
    height: 1px;
    background: #475569;
    transform: translateX(-50%);
}

.join-node-up-line {
    position: absolute;
    top: -50px;
    left: 50%;
    width: 1px;
    height: 50px;
    background: #475569;
    transform: translateX(-50%);
}

.join-node-arrow {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #475569;
}

.role-node::after {
    height: 50px !important;
    bottom: -50px !important;
    background: #475569 !important;
}

.role-node::before {
    display: none;
}

.role-node {
    border-color: rgba(16, 185, 129, 0.4);
}

.role-node h3 {
    color: #34d399;
}

.subject-list {
    font-size: 0.95rem;
    color: #cbd5f5;
    list-style: none;
    padding: 0;
    margin-top: 15px;
    text-align: left;
    display: inline-block;
}

.subject-list li {
    margin-bottom: 6px;
}

.subject-list li::before {
    content: '•';
    color: #60a5fa;
    margin-right: 10px;
}

.back-btn {
    display: inline-block;
    margin-top: 80px;
    margin-bottom: 40px;
    padding: 16px 40px;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    letter-spacing: 0.5px;
}

.back-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.5);
}

/* --- MOBILE RESPONSIVE STYLES --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .viz-container {
        gap: 80px;
    }

    .sphere {
        width: 280px;
        height: 280px;
    }

    /* Flow Chart Mobile Optimization */
    .roadmap-section {
        padding-top: 40px;
        margin-top: 40px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .flow-row {
        gap: 40px;
        margin-bottom: 40px;
        flex-direction: column;
        align-items: center;
    }

    /* Override min-width for mobile flexibility */
    .flow-node {
        min-width: unset;
        width: 100%;
        max-width: 320px;
    }

    /* Hide complex horizontal connectors on mobile */
    .flow-connector-horz,
    .join-connector,
    .join-node-up-line,
    .join-node-arrow,
    .branch-node .up-line,
    .branch-node .arrow-in {
        display: none !important;
    }

    /* Simplify connectors to just straight down lines */
    .flow-node::after {
        height: 40px;
        /* Match new margin-bottom */
        bottom: -42px;
        opacity: 0.5;
    }

    .flow-node::before {
        bottom: -48px;
    }

    /* Ensure last node in a stack sends a line to next row's first node? 
       Actually, since we made flow-row column, every node (except very last of layout) 
       should have a down arrow.
       Classes like .role-node might have specific overrides we need to reset.
    */
    .role-node::after {
        height: 40px !important;
        bottom: -42px !important;
    }

    /* Re-enable arrows for nodes that might have them disabled or custom styled */
    .flow-split-root::after {
        height: 40px !important;
        bottom: -42px !important;
    }

    /* We want lines between everything in the vertical stack.
       The last node of the whole diagram (Virtual Session) should have no line. */

    /* Fix branch container gap */
    .branch-container {
        gap: 40px;
    }

    /* Fix highlights acting as connectors */
    .join-node-arrow {
        display: none;
    }
}