/* Responsive, self-contained rendering for sanitized ProCyclingStats live fragments. */
#liveState {
    direction: ltr;
    min-width: 0;
    max-width: 100%;
    padding-bottom: 96px;
    color: var(--fg-1, #1a1f2b);
    overflow: hidden;
}

#liveState,
#liveState * {
    box-sizing: border-box;
}

#liveState .vo2-pcs-live-state,
#liveState .timeline3cont,
#liveState .timeline3,
#liveState .timeline3 > li.event,
#liveState .timeline3 > li.event > .cont,
#liveState .timeline3 .stat,
#liveState .timeline3 .chartCont {
    min-width: 0;
    max-width: 100%;
}

#liveState .ls5b-kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 10px 12px;
    width: 100%;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
}

#liveState .ls5b-kpi > li {
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
}

#liveState .ls5b-kpi > li > span {
    overflow: hidden;
    color: #8a94a3;
    font-size: 9px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#liveState .ls5b-kpi > li > div {
    margin-top: 2px;
    color: #111827;
    font-size: 13px;
    line-height: 1.35;
}

#liveState .timeline3cont {
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

#liveState .timeline3 {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    direction: ltr;
    font-size: 14px;
}

#liveState .timeline3 > li.event {
    position: relative;
    display: block;
    float: none;
    width: calc(100% - 14px);
    min-height: 48px;
    margin: 0 0 0 14px;
    padding: 0 0 22px 25px;
    border: 0;
    border-left: 2px solid #d8e0e9;
    list-style: none;
}

#liveState .timeline3 > li.event:last-child {
    padding-bottom: 0;
    border-left-color: transparent;
}

#liveState .timeline3 > li.event > .bol {
    position: absolute;
    z-index: 2;
    top: 13px;
    left: -13px;
    display: flex;
    float: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0;
    border: 2px solid #778391;
    border-radius: 50%;
    background: #fff;
    color: #4b5563;
    font-size: 10px;
    line-height: 1;
}

#liveState .timeline3 > li.event > .sub {
    position: absolute;
    top: 20px;
    left: -1px;
    float: none;
    width: 18px;
    height: 1px;
    margin: 0;
    border-top: 1px solid #778391;
}

#liveState .timeline3 > li.event > .sub span {
    top: -4px;
    right: auto;
    left: -4px;
}

#liveState .timeline3 > li.event.xbol > .sub,
#liveState .timeline3 > li.event.xsub > .bol {
    display: none;
}

#liveState .timeline3 > li.event.xbol > .cont,
#liveState .timeline3 > li.event.xsub > .cont,
#liveState .timeline3 > li.event > .cont {
    display: block;
    float: none;
    width: 100%;
    margin: 0;
    padding: 14px;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(31, 41, 55, 0.05);
}

#liveState .timeline3 .stat {
    display: block;
    float: none;
    width: 100%;
}

#liveState .timeline3 .timeago2:empty,
#liveState .timeline3 .timeago:empty,
#liveState .timeline3 .toggleRequestStat,
#liveState .timeline3 .toggleFindBib,
#liveState .timeline3 .toggleCountrySelection,
#liveState .timeline3 .show-all-link,
#liveState .timeline3 .showFullList {
    display: none !important;
}

#liveState .timeline3 .textCont {
    float: none !important;
    width: 100% !important;
    margin: 0;
    color: #263244;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.85;
    text-align: start;
    unicode-bidi: plaintext;
    overflow-wrap: anywhere;
}

#liveState .timeline3 .textCont + .clear,
#liveState .timeline3 .stat > .clear {
    clear: both;
}

#liveState .timeline3 .chartCont {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding-bottom: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

#liveState .pcs-live-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #e1e6ec;
    border-radius: 9px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

#liveState .chartCont > .pcs-live-table-scroll {
    margin: 0;
}

#liveState .timeline3 table,
#liveState .timeline3 table.pcs-live-table {
    width: 100% !important;
    min-width: 100%;
    max-width: none !important;
    margin: 0;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    direction: ltr;
    table-layout: auto;
    background: #fff;
    font-size: 13px;
}

#liveState .timeline3 table tr.hide {
    display: table-row !important;
}

#liveState .timeline3 table th,
#liveState .timeline3 table td {
    min-width: 54px;
    height: auto;
    padding: 9px 10px !important;
    border: 0;
    border-bottom: 1px solid #edf0f4;
    background: #fff;
    color: #344054;
    font-size: 12.5px;
    line-height: 1.45;
    text-align: left;
    vertical-align: middle;
    white-space: normal !important;
}

#liveState .timeline3 table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f6f8fb;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    white-space: nowrap !important;
}

#liveState .timeline3 table tbody tr:last-child td {
    border-bottom: 0;
}

#liveState .timeline3 table tbody tr:nth-child(even) td {
    background: #fafbfc;
}

#liveState .timeline3 table td a {
    display: inline-block;
    max-width: 260px;
    color: #087fca;
    text-decoration: none;
    white-space: normal;
}

#liveState .timeline3 .eventImage {
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid #e1e6ec;
    border-radius: 10px;
    background: #f6f8fb;
}

#liveState .timeline3 .eventImage img {
    display: block;
    width: 100%;
    max-width: 100% !important;
    height: auto;
    margin: 0 !important;
    object-fit: contain;
}

/* PCS ships the inline geometry for this chart, but its class rules live in a
   separate upstream stylesheet. Recreate those few rules locally so the
   sanitized, script-free chart remains complete and responsive. */
#liveState .gpxProfile2 {
    width: 100% !important;
    min-width: 0;
    max-width: none !important;
    margin: 0 auto;
    padding: 38px 10px 24px !important;
    overflow: hidden;
    border: 1px solid #d9e0e8;
    border-radius: 10px;
    background: linear-gradient(to bottom, #f8fafc 0, #fff 100%);
    direction: ltr;
}

#liveState .gpxProfile2 > ul {
    position: relative;
    display: flex;
    align-items: flex-end;
    width: 100%;
    min-height: 233px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#liveState .gpxProfile2 > ul > li {
    float: none !important;
    flex: 0 0 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
}

#liveState .gpxProfile2 > ul > li.clear {
    display: none;
}

#liveState .gpxProfile2 li div.line,
#liveState .gpxProfile2 li div.bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

#liveState .gpxProfile2 li div.line {
    z-index: 2;
    background: #0f5c70;
}

#liveState .gpxProfile2 li div.bg {
    z-index: 1;
    background: #c9f530;
}

#liveState .gpxProfile2 li:hover div.bg {
    background: #91e84f;
}

#liveState .gpxProfile2 .gradientTitle {
    position: absolute;
    z-index: 3;
    left: calc(50% - 9px);
    width: 18px;
    margin: 0;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

#liveState .gpxProfile2 .gradientGreen {
    background: #c9f530;
    color: #27313f;
}

#liveState .gpxProfile2 .gradientRed {
    background: #ef4444;
    color: #fff;
}

#liveState .gpxProfile2 .gradientBlack {
    background: #27313f;
    color: #fff;
}

#liveState .bigProfile,
#liveState .bigProfile > div,
#liveState .bigProfile .profileWrapper {
    max-width: 100% !important;
}

#liveState .bigProfile {
    width: 100% !important;
    padding-top: 50px !important;
    padding-bottom: 18px !important;
    border-radius: 10px;
    box-sizing: content-box !important;
}

/* Keep the distance scale as its own row below the elevation fill. PCS places
   the labels above an absolutely positioned bar, which overlays the profile. */
#liveState .bigProfile > div:first-child {
    bottom: 18px !important;
}

#liveState .bigProfile .kmbar {
    display: flex;
    direction: ltr;
    width: 100% !important;
    height: 18px;
    margin: 0;
    padding: 0;
    bottom: 0;
}

#liveState .bigProfile .kmbar li {
    float: none;
    flex: 1 1 0;
    width: auto !important;
    height: 4px;
}

#liveState .bigProfile .kmbar li span {
    top: 5px;
    left: 0;
    line-height: 11px;
    white-space: nowrap;
}

#liveState .bigProfile .xyProfileCont {
    width: 100%;
    min-height: 0;
    background: #9bd229 !important;
}

#liveState .bigProfile .xyProfileCont .xyProfile {
    width: 100%;
    min-height: 0;
    background: #fff !important;
}

/* PCS calculates both bigProfile height and xyProfile padding-bottom per race.
   They are inline values derived from that route's elevation scale. Never
   replace them with a fixed height: doing so exaggerates flat/low profiles. */
#liveState .bigProfile.pcs-profile-scaled .xyProfileCont .xyProfile {
    padding-bottom: var(--pcs-profile-elevation-height) !important;
}

#liveState .bigProfile .xyProfileCont .kmdone {
    z-index: 2;
    height: 1800px;
    position: absolute;
    background: #fff;
    opacity: 0.7;
}

#liveState .bigProfile .profileBottomPadding {
    background: #9bd229 !important;
}

#liveState .bigProfile .hoogtelijn {
    width: calc(100% - 20px);
}

#liveState .bigProfile .kp5_cont .title,
#liveState .bigProfile .profileKeypoint .kp_txt10 {
    padding: 2px 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.86);
    line-height: 1.15;
}

@media (max-width: 575.98px) {
    #liveState {
        width: 100%;
        padding-bottom: 118px;
        overflow: hidden;
    }

    #liveState .timeline3 > li.event {
        width: calc(100% - 9px);
        margin-left: 9px;
        padding-left: 18px;
        padding-bottom: 16px;
    }

    #liveState .timeline3 > li.event > .bol {
        left: -11px;
        width: 21px;
        height: 21px;
        font-size: 9px;
    }

    #liveState .timeline3 > li.event.xbol > .cont,
    #liveState .timeline3 > li.event.xsub > .cont,
    #liveState .timeline3 > li.event > .cont {
        padding: 12px;
        border-radius: 10px;
    }

    #liveState .timeline3 .textCont {
        font-size: 13px;
        line-height: 1.75;
    }

    #liveState .timeline3 table th,
    #liveState .timeline3 table td {
        padding: 8px !important;
        font-size: 12px;
    }

    #liveState .gpxProfile2 {
        padding: 32px 6px 24px !important;
    }

    #liveState .bigProfile {
        padding-top: 0 !important;
    }

    #liveState .bigProfile .kp5_cont .title,
    #liveState .bigProfile .profileKeypoint .kp_txt10 {
        width: 76px;
        left: -38px;
        font-size: 8px;
        line-height: 1.05;
    }

    #liveState .bigProfile .kp5_cont.ar .title {
        left: 0;
    }

    #liveState .bigProfile .kp5_cont.al .title {
        left: -76px;
    }

}
