.timeline-container {
    width: 100%;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
    font-family: sans-serif;
    min-height: 200px;
    /* margin: 20px 0; */
}

.timeline-wrapper {
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* Used for static layouts, kept for compatibility */
.timeline-row {
    position: relative;
    height: 100px;
    width: 100%;
    pointer-events: none;
}

/* The Point/Anchor on the timeline */
.timeline-item {
    position: absolute;
    width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* z-index: 1; */
    /* Determine top position via JS, but default to center for safety */
    top: 50%;
}

.timeline-badge {
    position: absolute;
    width: 150px;
    /* margin-left: -75px; */
    /* Center horizontally */

    /* Requirement: Specific color background, remove border */
    background-color: var(--badge-color);
    color: white;
    /* border: 1px solid #00000033; */
    /* padding: 8px 12px; */
    border-radius: 3px;
    /* box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5), 0 0 2px rgba(255, 255, 255, 0.9) inset; */
    font-size: 12px;
    line-height: 1.3;
    box-sizing: border-box;

    /* Requirement: Badges above connectors */
    z-index: 10;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Opacity 0 until JS layout runs to prevent FOUC */
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    box-shadow: 5px 5px 5px color-mix(in srgb, var(--fg) 40%, transparent);
    text-shadow: 1px 1px 1px #00000099;
}

/* Direction specific positioning for badges */
.timeline-top .timeline-badge {
    bottom: 0;
    /* margin-bottom: 10px; */
}

.timeline-bottom .timeline-badge {
    top: 0;
    /* margin-top: 10px; */
}

.timeline-label {
    font-weight: bold;
    color: white;
    margin-bottom: 2px;
    background-color: #00000011;
    padding: 10px 15px;
    border-bottom: 1px solid #ffffff31;
    width: 100%;
    text-align: center;
}

.timeline-date {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    padding: 1px 5px 3px;
}

.timeline-connector {
    position: absolute;
    left: -1px;
    /* Center on 0-width parent */
    width: 2px;

    /* Requirement: Match badge color */
    background-color: var(--badge-color);

    /* Requirement: Below badge */
    z-index: 1;
    opacity: .5;
}

/* Direction specific positioning for connectors */
.timeline-top .timeline-connector {
    bottom: 0;
}

.timeline-bottom .timeline-connector {
    top: 0;
}

.timeline-axis {
    position: absolute;
    /* Left/Right set inline by Python to account for extension logic */
    height: 2px;
    background-color: #ccc;
    z-index: 0;
}

.timeline-axis-endpoint {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #ccc;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.timeline-axis-endpoint.start {
    left: 0;
    margin-left: -4px;
    /* Center on the start tip */
}

.timeline-axis-endpoint.end {
    right: 0;
    margin-right: -4px;
    /* Center on the end tip */
}

.timeline-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    left: -5px;
    top: -5px;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);

    /* Match badge color */
    background-color: var(--badge-color);
    z-index: 5;
}

/* Legacy classes kept for compatibility */
.timeline-badge-content {
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    line-height: 1.3;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.timeline-axis-line {
    position: absolute;
    top: 0;
    left: 75px;
    right: 75px;
    height: 2px;
    background-color: #222;
    z-index: 0;
}

.timeline-axis-end-circle {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    background-color: #222;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.timeline-axis-dot {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 5;
}


.focused-item .timeline-badge {
    /* box-shadow: 0 0 10px var(--fg) !important; */
    /* border: 3px solid black !important; */
    position: relative;
    /* inset:0 */
    border: 1px solid var(--fg);
}

.focused-item .timeline-badge::before {
    position: absolute;
    --half: 4px;
    box-shadow: 0 0 10px var(--fg) !important;
    border-radius: var(--pill-radius);
    top: calc(-1 * var(--half));
    left: calc(-1 * var(--half));
    width: 100%;
    height: 100%;
    /* width:calc(100% + 2 * var(--half)); */
    /* height:calc(100% + 2 * var(--half));; */
    content: " ";
    border: calc(var(--half)) solid var(--fg);


}