/* stints-overview.css — Plan › Stints summary above the table (stints-overview.js).
 * Every rule is scoped under #stintsOverview (or the table row it flashes).
 * v2 tokens carry old-design fallbacks, so ?design=old still draws the band;
 * the v2-only type rules sit under :where(html:not(.design-old)). */
#stintsOverview { margin: 0 0 var(--s3, 12px); display: grid; gap: 4px; min-width: 0; }

#stintsOverview .sov-stats { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--text-3); }
#stintsOverview .sov-stats b { color: var(--text-hi); font-variant-numeric: tabular-nums; }
#stintsOverview .sov-stats .is-bad b { color: var(--crit); }

/* Pit markers 12 + band 28 + axis 14: about 56px. */
#stintsOverview .sov-tl { padding: 0 2px; min-width: 0; }
#stintsOverview .sov-pits { position: relative; height: 12px; }
#stintsOverview .sov-pit { position: absolute; top: 1px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%;
    box-sizing: border-box; border: 2px solid var(--text-hi); background: var(--text-hi); cursor: help; }
#stintsOverview .sov-pit.tsome { background: linear-gradient(90deg, var(--text-hi) 50%, transparent 50%); }
#stintsOverview .sov-pit.t0 { background: transparent; border-color: var(--text-3); }

#stintsOverview .sov-band { position: relative; height: 28px; background: var(--v2-inset, var(--surface-2)); border-radius: var(--v2-r-sm, 3px); }
#stintsOverview .sov-seg { position: absolute; top: 0; bottom: 0; margin: 0; padding: 0 1px; border: 0; border-radius: 2px;
    --sov-c0: var(--sov-c, var(--info));
    /* Planned: the driver's full color, the normal look before a race. */
    background: var(--sov-c0); box-shadow: none;
    color: color-mix(in srgb, #000 82%, var(--sov-c0)); cursor: pointer; overflow: hidden; opacity: 1;
    font-family: inherit; font-weight: 600; font-size: 11px; line-height: 28px; text-align: center; white-space: nowrap;
    transform: none; height: auto; min-height: 0; min-width: 0; }
#stintsOverview .sov-seg.on-dark { color: color-mix(in srgb, #fff 92%, var(--sov-c0)); }
/* No driver yet: an outlined tint of the info color, still clearly a stint. */
#stintsOverview .sov-seg.no-driver { background: color-mix(in srgb, var(--info) 26%, var(--v2-panel, var(--surface-1)));
    box-shadow: inset 0 0 0 1px var(--info); color: var(--text-hi); }
/* Done: the variation. A deeper shade with a check mark. */
#stintsOverview .sov-seg.is-done { background: color-mix(in srgb, var(--sov-c0) 50%, var(--v2-page, var(--bg)));
    box-shadow: none; color: var(--text-hi); }
/* On track: full color with a strong outline; the now line marks where in it. */
#stintsOverview .sov-seg.is-now { box-shadow: inset 0 0 0 2px var(--text-hi), 0 0 0 1px var(--v2-page, var(--bg)); z-index: 1; }
/* Wet: a blue top edge. Fuel save: a dashed bottom edge. */
#stintsOverview .sov-seg.is-wet::before,
#stintsOverview .sov-seg.is-fs::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; pointer-events: none; }
#stintsOverview .sov-seg.is-wet::before { top: 0; background: var(--info); }
#stintsOverview .sov-seg.is-fs::after { bottom: 0; background: repeating-linear-gradient(90deg, var(--text-hi) 0 4px, transparent 4px 7px); }
#stintsOverview .sov-seg:hover { filter: brightness(1.15); transform: none; }
#stintsOverview .sov-seg:focus-visible { outline: 2px solid var(--text-hi); outline-offset: 1px; z-index: 2; }
#stintsOverview .sov-seg span { pointer-events: none; }

#stintsOverview .sov-now { position: absolute; top: -14px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--crit); z-index: 3; pointer-events: none; }
#stintsOverview .sov-flag { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--text-3); z-index: 1; pointer-events: none; }

#stintsOverview .sov-wx { position: relative; height: 4px; margin-top: 2px; }
#stintsOverview .sov-wx span { position: absolute; top: 0; bottom: 0; background: var(--info); border-radius: 2px; }
#stintsOverview .sov-wx span.is-wet { background: var(--accent); }

#stintsOverview .sov-axis { position: relative; height: 14px; margin-top: 1px; font-size: 11px; line-height: 14px; color: var(--text-3); }
#stintsOverview .sov-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
#stintsOverview .sov-axis span:first-child { transform: none; }
#stintsOverview .sov-axis span.at-end { transform: translateX(-100%); }

/* One-line key: who is which color. What the marks mean is in the Explanation. */
#stintsOverview .sov-key { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 11px; color: var(--text-2); }
#stintsOverview .sov-key > span,
#stintsOverview .sov-keystate > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
#stintsOverview .sov-keystate { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
#stintsOverview .sov-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#stintsOverview .sov-dot.no-driver { box-sizing: border-box; border: 1px solid var(--info); background: color-mix(in srgb, var(--info) 26%, transparent); }
#stintsOverview .sov-nodrv { color: var(--text-2); white-space: normal; }
#stintsOverview .sov-todrivers { all: unset; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
#stintsOverview .sov-todrivers:focus-visible { outline: 2px solid var(--text-hi); outline-offset: 1px; }
#stintsOverview .sov-keystate i { display: inline-block; flex: none; width: 14px; height: 9px; border-radius: 2px; box-sizing: border-box; }
#stintsOverview .sov-keystate .sk-now { width: 2px; height: 12px; border-radius: 0; background: var(--crit); }
#stintsOverview .sov-keystate .sk-wet { border-top: 3px solid var(--info); background: var(--line-3); }
#stintsOverview .sov-keystate .sk-fs { background: repeating-linear-gradient(90deg, var(--text-hi) 0 4px, transparent 4px 7px) bottom / 100% 3px no-repeat, var(--line-3); }
#stintsOverview .sov-keystate .sov-pit { position: static; margin: 0 0 0 4px; cursor: default; width: 9px; height: 9px; border-radius: 50%; }
#stintsOverview .sov-keystate .sov-pit:first-child { margin-left: 0; }

#stintsOverview .sov-flagged { margin: 6px 0 0; color: var(--warn); font-size: 12px; font-weight: 600; }
#stintsOverview .sov-share { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; max-width: 760px; }
#stintsOverview .sov-share li { display: grid; grid-template-columns: minmax(70px, 140px) minmax(80px, 1fr) auto; align-items: center; gap: 2px 10px; font-size: 13px; }
#stintsOverview .sov-name { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
#stintsOverview .sov-name i { flex: none; width: 10px; height: 10px; border-radius: 50%; }
#stintsOverview .sov-bar { position: relative; height: 6px; background: var(--v2-inset, var(--surface-2)); border-radius: 3px; overflow: hidden; }
#stintsOverview .sov-bar span { display: block; height: 100%; background: var(--line-3); }
#stintsOverview .sov-even { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text-2); opacity: .7; }
#stintsOverview .sov-meta { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 11px; }
#stintsOverview .sov-note { grid-column: 2 / -1; color: var(--warn); font-size: 11px; }

:where(html:not(.design-old)) #stintsOverview .sov-stats,
:where(html:not(.design-old)) #stintsOverview .sov-seg,
:where(html:not(.design-old)) #stintsOverview .sov-axis,
:where(html:not(.design-old)) #stintsOverview .sov-key { font-family: var(--v2-font-display); }
:where(html:not(.design-old)) #stintsOverview .sov-stats b,
:where(html:not(.design-old)) #stintsOverview .sov-seg { font-stretch: 88%; }

#stintScheduleBody tr.sov-flash td { animation: sov-flash 2s ease-out; }
@keyframes sov-flash { from { box-shadow: inset 0 0 0 9999px var(--v2-wash, var(--accent-soft)); } to { box-shadow: inset 0 0 0 9999px transparent; } }

@media (max-width: 600px) {
    #stintsOverview .sov-stats { gap: 2px 10px; }
    #stintsOverview .sov-share li { grid-template-columns: 1fr auto; }
    #stintsOverview .sov-bar { grid-column: 1 / -1; grid-row: 2; }
    #stintsOverview .sov-note { grid-column: 1 / -1; grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) { #stintScheduleBody tr.sov-flash td { animation: none; box-shadow: inset 0 0 0 9999px var(--v2-wash, var(--accent-soft)); } }

/* Who is which color and what the marks mean, on one wrapping line under the band. */
#stintsOverview .sov-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; }
#stintsOverview .sov-keys .sov-keystate { margin: 0; font-size: 11px; color: var(--text-2); }
#stintsOverview .sov-stops { margin: 4px 0 8px; padding-left: 18px; font-variant-numeric: tabular-nums; }

/* Stints table: the tire chip opens the Tires stop menu; Stop time shows its sums. */
#stintScheduleTable .stint-tire-btn { cursor: pointer; }
#stintScheduleTable .stint-tire-btn:hover { border-color: var(--accent); filter: none; }
html body #stintScheduleTable .stint-tire-btn.is-keep { background: none; border: 1px dashed var(--line-2); color: var(--text-3); }
/* tire-strategy.js drops has-tires on a no-change stop; the button still says Keep, without the dash. */
#stintScheduleTable .stint-tire-btn.is-keep::before { content: none; }
#stintScheduleTable .stop-btn { min-height: 26px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: none;
    color: var(--text-2); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
#stintScheduleTable .stop-btn:hover, #stintScheduleTable .stop-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--text-hi, var(--text)); }
#stintScheduleTable :is(.stint-tire-btn, .stop-btn):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#stintScheduleTable .stop-none { color: var(--text-4); }
#stintScheduleTable .stop-brake { display: block; width: max-content; margin: 2px auto 0; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 700;
    background: var(--warn-dim); color: var(--warn-soft, var(--warn)); }
.sov-stop-pop { position: fixed; z-index: 1000; max-width: min(320px, calc(100vw - 8px)); padding: 8px 12px; border-radius: 6px;
    background: var(--panel-2, var(--surface-2)); border: 1px solid var(--line-2, var(--line)); box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
    font-size: 13px; line-height: 1.45; color: var(--text); font-variant-numeric: tabular-nums; }
.sov-stop-pop b { color: var(--text-hi, var(--text)); }
.sov-stop-pop ul { margin: 4px 0 0; padding-left: 16px; }

/* Fuel and tire strategy: a chip that opens that group's Strategy cards in a panel (.strat-pop). */
:is(.plan-toolbar, .tov-controls) .fuel-mode-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 2px 12px; border-radius: 999px;
    border: 1px solid var(--line-2, var(--line)); color: var(--text-2); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
    background: none; font-family: inherit; cursor: pointer; max-width: 100%; }
:is(.plan-toolbar, .tov-controls) .fuel-mode-chip[aria-expanded="true"] { border-color: var(--accent); color: var(--text-hi, var(--text)); }
.strat-pop { position: absolute; z-index: 900; box-sizing: border-box; max-height: min(78vh, 720px); overflow: auto; padding: 12px 14px 4px;
    background: var(--panel, var(--surface)); border: 1px solid var(--line-2, var(--line)); border-radius: var(--radius, 10px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.strat-pop:focus { outline: none; }
.strat-pop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:is(.plan-toolbar, .tov-controls) .fuel-mode-chip b { color: var(--text-hi, var(--text)); }
:is(.plan-toolbar, .tov-controls) .fuel-mode-chip:hover { border-color: var(--accent); color: var(--text-hi, var(--text)); }
:is(.plan-toolbar, .tov-controls) .fuel-mode-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Plan sub-tabs: fade the side that scrolls (plan-tabs.js sets fade-l / fade-r). */
#tab0 .plan-jump.fade-r { -webkit-mask-image: linear-gradient(to left, transparent, #000 44px); mask-image: linear-gradient(to left, transparent, #000 44px); }
#tab0 .plan-jump.fade-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 44px); mask-image: linear-gradient(to right, transparent, #000 44px); }
#tab0 .plan-jump.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent); }
/* A jump to a field inside a Plan section lands below the sticky bars, not under them. */
#app #tab0 .plan-sec [id] { scroll-margin-top: calc(var(--tk-h, 0px) + var(--tabs-h, 46px) + 64px); }

/* Phones: # · Type · Tires · End · Laps · Driver. Start, Load VE and Stop time are in the Explanation. */
@media (max-width: 600px) {
    html body #stintScheduleTable { min-width: 0; width: 100%; }
    html body #stintScheduleTable :is(th, td):is(:nth-child(4), :nth-child(7), :nth-child(9)) { display: none; }
    html body #stintScheduleTable :is(th, td) { padding: 3px 2px; }
    html body #stintScheduleTable :is(th, td):nth-child(1) { width: 24px; }
    html body #stintScheduleTable :is(th, td):nth-child(2) { width: 48px; }
    html body #stintScheduleTable :is(th, td):nth-child(3) { width: 64px; }
    html body #stintScheduleTable :is(th, td):nth-child(5) { width: 76px; }
    html body #stintScheduleTable :is(th, td):nth-child(6) { width: 48px; }
    html body #stintScheduleTable :is(th, td):nth-child(8) { width: auto; }
    html body #stintScheduleTable .end-time-input { width: 100%; padding: 0 2px; }
    html body #stintScheduleTable .laps-input { width: 40px; padding: 0 2px; }
    html body #stintScheduleTable .tire-chip { padding: 0 3px; gap: 2px; font-size: 11px; white-space: nowrap; }
    html body #stintScheduleTable td.stint-num[data-status]::after { display: block; margin: 2px 0 0; padding: 0 2px; font-size: 8px; }
}

/* Final / Now / Done sits on the stint number; the cell's text stays the number (plan image, jump links read it). */
#stintScheduleTable td.stint-num[data-status]::after { content: attr(data-status); display: inline-block; margin-left: 6px; padding: 1px 6px;
    border-radius: 999px; border: 1px solid var(--line-2); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--info); vertical-align: middle; }

/* Driver warnings (roster-scheduling.js paintAssignmentIssues): the banner spans both
 * Drivers columns, and a stint row with a warning gets an amber edge on its number. */
#driverIssues { grid-column: 1 / -1; }
#stintScheduleBody tr.aa-issue > td:first-child { box-shadow: inset 3px 0 0 var(--warn); color: var(--warn); font-weight: 700; }
/* A driver set by hand (driverPins): its pin sits before the driver chip and clears it on click. */
.driver-pin { background: none; border: 0; padding: 0 4px 0 0; cursor: pointer; font-size: 12px; line-height: 1; }
.driver-pin:hover, .driver-pin:focus-visible { filter: brightness(1.3); }
