.ct-timeline-wrapper {
    position: relative;
    width: auto;
    margin: 50px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ct-timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    background: #999;
    z-index: 1;
}

.ct-timeline-item {
    position: relative;
    text-align: center;
    flex: 1;
}

.ct-circle {
    position: relative;
    z-index: 2;
    background: #666;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    line-height: 30px;
    margin: 0 auto;
    font-weight: bold;
}

.ct-year {
    font-size: 18px;
    font-weight: bold;
    color: red;
    margin-top: 10px;
    cursor: pointer;
}

.ct-timeline-item.up .ct-year {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
}

.ct-timeline-item.down .ct-year {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
}

.ct-content {
    display: none;
    background: #f1f1f1;
    padding: 10px;
    border-radius: 8px;
    position: absolute;
    width: 200px;
    left: 40%;
    transform: translateX(-50%);
    z-index: 3;
     font-size: 12px;
}

.ct-timeline-item.up .ct-content {
    top: -120px;
}

.ct-timeline-item.down .ct-content {
    bottom: -120px;
}

/*.ct-year:hover + .ct-content,*/
/*.ct-content:hover {*/
/*    display: block;*/
/*}*/

/* Desktop hover only */
@media (min-width: 769px) {
    .ct-year:hover + .ct-content {
        display: block;
    }
}

/* Mobile: hover disable */
@media (max-width: 768px) {
    .ct-year:hover + .ct-content {
        display: none !important;
    }

    .ct-timeline-item.active .ct-content {
        display: block;
    }
}

/* Responsive */
@media(max-width:768px) {
    .ct-timeline-wrapper {
        flex-direction: column;
        width: 90%;
        position: relative;
    }

    /* Create a vertical line in the center */
    .ct-timeline-wrapper::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        height: 100%;
        width: 4px;
        background: #999;
        z-index: 1;
    }

    .ct-timeline-line {
        display: none; /* Hide horizontal line */
    }

    .ct-timeline-item {
        margin: 30px 0;
        width: 100%;
        position: relative;
    }

    .ct-circle {
        position: absolute;
        left: 50%;
        top: 0;
        transform: translateX(-50%);
        z-index: 2;
        background: #666;
    }

    /* Container for year and content */
    .ct-item-content {
        width: 45%; /* Take up less than half the width */
        padding: 10px;
        position: relative;
    }

    /* Position UP items to the LEFT */
    .ct-timeline-item.up .ct-item-content {
        float: left;
        text-align: right;
    }

    /* Position DOWN items to the RIGHT */
    .ct-timeline-item.down .ct-item-content {
        float: right;
        text-align: left;
    }

    /* Clear floats */
    .ct-timeline-item::after {
        content: "";
        display: table;
        clear: both;
    }

    .ct-year {
        margin-top: 0;
    }

    .ct-content,
    .ct-timeline-item.up .ct-content,
    .ct-timeline-item.down .ct-content {
        position: static;
        display: none; /* Initially hidden */
        width: 100%;
        transform: none;
        margin-top: 0px !important;
        background: #f1f1f1;
        padding: 5px;
        border-radius: 8px;
        text-align: left;
    }

    .ct-timeline-item.down .ct-year,
    .ct-timeline-item.up .ct-year {
        position: static;
        transform: none;
    }

    .ct-year:hover + .ct-content {
        display: none; /* Disable hover on mobile */
    }
}
