/* Reset box-sizing */
#tree, #tree * {
    box-sizing: border-box;
}
/* Tree container */
#tree {
    display: inline-block;
    padding: 10px;
}
/* Branch spacing */
.branch {
    padding: 5px 30px 5.4px 20px;
}

    .branch:not(:first-child) {
        margin-left: 170px;
    }
/* Entry base */
.entry {
    position: relative;
    min-height: 50px;
    display: block;
}
/* Depth 1 */
.depth-1-in:after {
    content: "";
    width: 40px;
    border-top: 1px solid #777;
    position: absolute;
    left: -40px;
    top: 50%;
}
/* Depth 2 */
.depth-2-in:before {
    content: "";
    width: 30px;
    border-top: 1px solid #777;
    position: absolute;
    top: 50%;
    left: 20px;
}

.depth-2-in:after {
    content: "";
    width: 40px;
    border-top: 1px solid #777;
    position: absolute;
    left: -40px;
    top: 50%;
    margin-left: -62px;
}
/* Depth 3 */
.depth-3-in:before {
    content: "";
    height: 100%;
    border-left: 1px solid #777;
    position: absolute;
    left: -30px;
    margin-left: -25%;
}

.depth-3-in:first-child:before {
    content: "";
    height: 55%;
    border-left: 1px solid #777;
    position: absolute;
    left: -30px;
    top: 47%;
}

.depth-3-in:last-child:before {
    content: "";
    height: 45%;
    border-left: 1px solid #777;
    position: absolute;
    left: -30px;
    margin-left: -25%;
}

.depth-3-in:after {
    content: "";
    width: 30px;
    border-top: 1px solid #777;
    position: absolute;
    left: -30px;
    top: 50%;
    margin-top: -4px;
    margin-left: -25%;
}
/* Depth 4 */
.depth-4-in:before {
    content: "";
    height: 100%;
    border-left: 1px solid #777;
    position: absolute;
    left: -50%;
    top: -3px;
}

.depth-4-in:first-child:before {
    content: "";
    height: 51%;
    border-left: 1px solid rgb(119, 119, 119);
    position: absolute;
    left: -50%;
    top: 43%;
}

.depth-4-in:first-child:after {
    content: "";
    width: 30px;
    transition: border 0.5s;
    border-top: 1px solid rgb(119, 119, 119);
    position: absolute;
    left: -33px;
    top: 50%;
    margin-left: -36%;
    margin-top: -3px;
}

.depth-4-in:after {
    content: "";
    width: 30px;
    transition: border 0.5s;
    border-top: 1px solid #777;
    position: absolute;
    left: -34px;
    top: 50%;
    margin-left: -36%;
    margin-top: -3px;
}

.depth-4-in:last-child:before {
    content: "";
    height: 50%;
    border-left: 1px solid #777;
    position: absolute;
    left: -50%;
    top: -3px;
}

.depth-4-in:last-child:after {
    content: "";
    width: 32px;
    transition: border 0.5s;
    border-top: 1px solid #777;
    position: absolute;
    left: -34px;
    top: 50%;
    margin-left: -36%;
    margin-top: -3px;
}

.depth-4-in:only-child:before {
    content: "" !important;
    height: 0% !important;
    border-top: 1px solid #777 !important;
    position: absolute !important;
    left: -64% !important;
    width: 30px !important;
    top: 44% !important;
}

.depth-4-in:only-child:after {
    content: "" !important;
    height: 0% !important;
    border-top: 1px solid #777 !important;
    position: absolute !important;
    left: -16% !important;
    width: 36px !important;
    top: 50% !important;
}

.depth-5-in:before {
    content: "";
    width: 20px;
    transition: border 0.5s;
    border-top: 1px solid #777;
    position: absolute;
    left: -25px;
    top: 44%;
}

.depth-5-in:after {
    content: "";
    height: 0%;
    border-top: 1px solid #777;
    position: absolute;
    left: -45px;
    width: 20px;
    top: 44%;
}

.depth-0-span {
    margin-left: -10%;
    border: 1px solid #777;
    display: inline-block;
    min-width: 23.7%;
    padding: 5px 10px;
    line-height: 30px;
    text-align: center;
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -20px;
    color: #666;
    font-family: 'B Titr', arial, 'iran-sans';
    font-size: 14px;
    border-radius: 5px;
    transition: all 0.5s;
}

.depth-1-span {
    border: 1px solid #777;
    display: inline-block;
    min-width: 10%;
    padding: 5px 10px;
    line-height: 20px;
    text-align: center;
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -15px;
    color: #666;
    font-size: 14px;
    font-family: 'B Titr', arial, 'iran-sans';
    border-radius: 5px;
    transition: all 0.5s;
}

.depth-2-span {
    border: 1px solid #777;
    display: inline-block;
    min-width: 12%;
    padding: 5px 10px;
    line-height: 20px;
    text-align: center;
    position: absolute;
    left: -62px;
    top: 50%;
    margin-top: -15px;
    color: #666;
    font-family: 'B Titr', arial, 'iran-sans';
    font-size: 14px;
    border-radius: 5px;
    transition: all 0.5s;
}

.depth-3-span {
    border: 1px solid #777;
    display: inline-block;
    min-width: 150px;
    padding: 5px 10px;
    line-height: 20px;
    text-align: center;
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -19px;
    margin-left: -25%;
    color: #666;
    font-family: 'B Titr', arial, 'iran-sans';
    font-size: 14px;
    border-radius: 5px;
    transition: all 0.5s;
}

.depth-4-span {
    border: 1px solid #777;
    display: inline-block;
    min-width: 236px;
    padding: 5px 10px;
    line-height: 20px;
    text-align: center;
    position: absolute;
    left: -3px;
    top: 50%;
    margin-top: -18.5px;
    margin-left: -36%;
    color: #666;
    font-family: 'B Titr', arial, 'iran-sans';
    font-size: 14px;
    border-radius: 5px;
    transition: all 0.5s;
}

.depth-5-span {
    border: 1px solid #777;
    display: inline-block;
    min-width: 225px;
    padding: 5px 10px;
    line-height: 20px;
    text-align: center;
    position: absolute;
    left: -5px;
    top: 50%;
    margin-top: -18.5px;
    margin-left: -36%;
    color: #666;
    font-family: 'B Titr', arial, 'iran-sans';
    font-size: 12px;
    border-radius: 5px;
    transition: all 0.5s;
}

.inner-span:before {
    content: "";
    width: 36px;
    border-top: 1px solid rgb(119, 119, 119);
    position: absolute;
    left: -64.5%;
    top: 92%;
    transition: border 0.5s;
}

.inner-span-2chiled:before {
    content: "";
    width: 30px;
    border-top: 1px solid rgb(119, 119, 119);
    position: absolute;
    left: -61.5%;
    top: 92%;
    transition: border 0.5s;
}

.inner-span-3:before {
    content: "";
    width: 40px;
    border-top: 1px solid #777;
    position: absolute;
    margin-right: 148%;
    top: 44%;
    transition: border 0.5s;
}

.inner-span-5:before {
    content: "";
    width: 35px;
    border-top: 1px solid #777;
    position: absolute;
    left: -64.5%;
    top: 44%;
    transition: border 0.5s;
}

.inner-span-14:before {
    content: "";
    width: 63px;
    border-top: 1px solid #777;
    position: absolute;
    margin-right: 19.2rem;
    top: 44%;
    transition: border 0.5s;
}

#tree .entry span:hover,
#tree .entry span:hover + .branch .entry span {
    background: rgba(163, 199, 255, 0.58);
    color: #000;
    border-color: #000;
}

    #tree .entry span:hover + .branch .entry::after,
    #tree .entry span:hover + .branch .entry::before,
    #tree .entry span:hover + .branch::before,
    #tree .entry span:hover + .branch .branch::before {
        border-color: #000;
    }
    #tree .entry span:hover span::before,
    #tree .entry span:hover span::after {
        border-color: #000;
    }

    #tree .entry span:hover .inner-span::after,
    #tree .entry span:hover .inner-span::before,
    #tree .entry span:hover .inner-span-3::after,
    #tree .entry span:hover .inner-span-3::before,
    #tree .entry span:hover .inner-span-5::after,
    #tree .entry span:hover .inner-span-5::before,
    #tree .entry span:hover .inner-span-14::after,
    #tree .entry span:hover .inner-span-14::before,
    #tree .entry span:hover .inner-span-2chiled::after,
    #tree .entry span:hover .inner-span-2chiled::before {
        border-color: #000;
    }

#tree .entry .depth-3-span:hover + .depth-4-span::before,
#tree .entry .depth-3-span:hover + .depth-4-span::after {
    border-color: #000;
}
#tree .entry span:hover + .branch .entry .depth-4-span::after,
#tree .entry span:hover + .branch .entry .depth-4-span::before,
#tree .entry span:hover + .branch .depth-4-span::before,
#tree .entry span:hover + .branch .depth-4-span::before {
    border-color: #000;
}
