/* Qualifying → starting grid → race position graph (race-result.html only). */
body > .container {
    max-width: 1440px !important;
}

.race-progression-shell {
    margin: 0 0 32px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 20px;
    background:
        radial-gradient(circle at 78% 5%, rgba(255, 24, 59, 0.08), transparent 28%),
        linear-gradient(155deg, rgba(23, 25, 36, 0.98), rgba(10, 12, 19, 0.99));
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.race-flow-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    padding: 22px 24px 15px;
}

.race-flow-kicker {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.race-flow-icon {
    position: relative;
    width: 30px;
    height: 30px;
    color: #ff183b;
    flex: 0 0 30px;
}

.race-flow-icon::before,
.race-flow-icon::after {
    content: "";
    position: absolute;
    border: 2px solid currentColor;
}

.race-flow-icon::before {
    inset: 4px 14px 14px 4px;
    border-right: 0;
    border-bottom: 0;
}

.race-flow-icon::after {
    inset: 14px 4px 4px 14px;
    border-left: 0;
    border-top: 0;
}

.race-flow-icon span,
.race-flow-icon i {
    position: absolute;
    width: 7px;
    height: 7px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.race-flow-icon span {
    left: 1px;
    top: 11px;
}

.race-flow-icon i {
    right: 1px;
    bottom: 11px;
}

.race-flow-title {
    margin: 0;
    color: #f8f9fc;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    font-weight: 900;
    letter-spacing: -0.035em;
}

.race-flow-subtitle {
    margin: 5px 0 0 42px;
    color: #8f96aa;
    font-size: 0.78rem;
    line-height: 1.55;
}

.race-flow-race-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.035);
    color: #d8dbe5;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.race-flow-race-chip .flag {
    font-size: 1rem;
}

.race-flow-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 22px;
    padding: 0 24px 16px;
}

.race-flow-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 13px;
    color: #9ca2b4;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.04em;
}

.race-flow-legend strong {
    color: #b9becc;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.race-flow-legend .gain {
    color: #08d986;
}

.race-flow-legend .loss {
    color: #ff4a59;
}

.race-flow-legend .hold {
    color: #9297a5;
}

.race-flow-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex-wrap: wrap;
}

.race-flow-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.045);
    color: #8f96a9;
    font-size: 0.68rem;
    font-weight: 750;
}

.race-flow-stat b {
    color: #eef0f7;
    font-variant-numeric: tabular-nums;
}

.race-flow-scroll {
    position: relative;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-color: #ff183b #141620;
    scrollbar-width: thin;
}

.race-flow-canvas {
    position: relative;
    min-width: 1160px;
    padding: 0 14px 12px;
}

.race-flow-svg {
    display: block;
    width: 100%;
    min-width: 1130px;
    height: auto;
    overflow: visible;
}

.race-flow-row {
    stroke: rgba(255, 255, 255, 0.038);
    stroke-width: 18;
    stroke-linecap: round;
}

.race-flow-stage {
    fill: #9298aa;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.race-flow-stage-line {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
    stroke-dasharray: 3 7;
}

.flow-driver {
    opacity: 1;
    transition: opacity 160ms ease;
    cursor: pointer;
    outline: none;
}

.race-flow-svg.is-focused .flow-driver:not(.is-active) {
    opacity: 0.1;
}

.flow-path {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
    opacity: 0.58;
    transition: opacity 160ms ease, stroke-width 160ms ease;
}

.flow-driver:hover .flow-path,
.flow-driver:focus .flow-path,
.flow-driver.is-active .flow-path {
    stroke-width: 10;
    opacity: 0.96;
}

.flow-node {
    stroke: rgba(255, 255, 255, 0.26);
    stroke-width: 1;
    rx: 4;
}

.flow-label {
    fill: #c4c8d4;
    font-size: 11px;
    font-weight: 720;
    letter-spacing: 0.015em;
    font-variant-numeric: tabular-nums;
}

.flow-grid-number {
    fill: #757b8d;
    font-size: 9px;
    font-weight: 760;
    font-variant-numeric: tabular-nums;
}

.flow-driver:hover .flow-label,
.flow-driver:focus .flow-label,
.flow-driver.is-active .flow-label {
    fill: #fff;
}

.race-flow-tooltip {
    position: absolute;
    z-index: 5;
    display: none;
    width: 245px;
    padding: 12px 13px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(8, 10, 16, 0.96);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.4);
    color: #c9ceda;
    pointer-events: none;
    backdrop-filter: blur(16px);
}

.race-flow-tooltip.is-visible {
    display: block;
}

.race-flow-tooltip strong {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #fff;
    font-size: 0.86rem;
}

.race-flow-tooltip .team-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.race-flow-tooltip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.race-flow-tooltip-grid span {
    display: grid;
    gap: 2px;
    padding: 6px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.045);
    color: #7f8698;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.race-flow-tooltip-grid b {
    color: #f2f4f8;
    font-size: 0.77rem;
    letter-spacing: 0;
}

.race-flow-foot {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 24px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.065);
    color: #747c91;
    font-size: 0.69rem;
    line-height: 1.55;
}

.race-flow-foot a {
    color: #9db8ff;
    text-decoration: none;
    white-space: nowrap;
}

.race-flow-foot a:hover {
    color: #fff;
    text-decoration: underline;
}

.race-flow-swipe {
    display: none;
    white-space: nowrap;
    color: #a3a9ba;
}

@media (max-width: 720px) {
    .race-progression-shell {
        margin-bottom: 24px;
        border-radius: 16px;
    }

    .race-flow-head {
        display: grid;
        padding: 18px 16px 12px;
    }

    .race-flow-race-chip {
        justify-self: start;
        margin-left: 42px;
    }

    .race-flow-meta {
        justify-content: flex-start;
        padding: 0 16px 14px;
    }

    .race-flow-legend,
    .race-flow-stats {
        justify-content: flex-start;
    }

    .race-flow-canvas {
        padding-inline: 8px;
    }

    .race-flow-foot {
        padding: 12px 16px 15px;
    }

    .race-flow-swipe {
        display: inline;
    }
}

@media (prefers-reduced-motion: reduce) {
    .flow-driver,
    .flow-path {
        transition: none !important;
    }
}
