.tree, .tree ul {
    padding-top: 20px; position: relative;
    display: flex; justify-content: center;
}

.tree ul {
    padding-top: 40px;
}

.tree li {
    list-style-type: none;
    text-align: center;
    position: relative;
    padding: 20px 10px 0 10px;
}

.tree li::before, .tree li::after {
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 3px solid #333;
    width: 50%; height: 20px;
}

.tree li::after {
    right: auto; left: 50%;
    border-left: 3px solid #333;
}

.tree li:only-child::before, .tree li:only-child::after {
    display: none;
}

.tree li:only-child {
    padding-top: 0;
}

.tree li:first-child::before, .tree li:last-child::after {
    border: 0 none;
}

.tree li:last-child::before {
    border-right: 3px solid #333;
    border-radius: 0 5px 0 0;
}

.tree li:first-child::after {
    border-radius: 5px 0 0 0;
}

.node {
    display: inline-block;
    border: 2px solid #333;
    padding: 10px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
}

.node img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 5px;
}

.name {
    font-weight: bold;
    cursor: pointer;
}

.popup {
    display: none;
    position: absolute;
    background-color: white;
    border: 2px solid #333;
    padding: 10px;
    z-index: 999;
    border-radius: 8px;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.popup .close {
    float: right;
    cursor: pointer;
    font-weight: bold;
}
