:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --surface: #fcfcfb;
  --line: #e2e0d9;
  --grid: #ebe9e3;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7a7974;
  --accent: #eda100;          /* Corvette yellow, series slot 1 */
  --accent-ink: #8a5d00;
  --series-2: #2a78d6;
  --context: #c9c7c0;
  --good: #0ca30c;
  --critical: #d03b3b;
  --row-hl: #fdf3dc;
  --on-accent: #111;
  --flag-yellow: #8a5d00;
  --livery: linear-gradient(90deg, #eda100 0 33.3%, #111 33.3% 66.7%, #eda100 66.7%);
  /* strategy charts: validated categorical slots (selected car, car ahead, car behind) */
  --s1: #eda100; --s2: #2a78d6; --s3: #1baf7a;
  --s4: #eb6834;   /* championship threat (paired with --s2 for the target) */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --line: #2e2e2b;
    --grid: #262624;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #8f8e86;
    --accent: #eda100;
    --accent-ink: #f5c04a;
    --series-2: #3987e5;
    --context: #46463f;
    --row-hl: #2a2414;
    --flag-yellow: #f5c04a;
    --s1: #c98500; --s2: #3987e5; --s3: #199e70; --s4: #d95926;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --line: #2e2e2b; --grid: #262624;
  --text: #ffffff; --text-2: #c3c2b7; --text-3: #8f8e86;
  --accent: #eda100; --accent-ink: #f5c04a; --series-2: #3987e5;
  --context: #46463f; --row-hl: #2a2414; --flag-yellow: #f5c04a;
  --s1: #c98500; --s2: #3987e5; --s3: #199e70; --s4: #d95926;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
h1, h2, .num { font-family: Oswald, Impact, sans-serif; font-weight: 600; letter-spacing: .01em; }
header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 24px; margin-bottom: 20px; }
h1 { margin: 0; font-size: clamp(28px, 6vw, 40px); line-height: 1.05; text-transform: uppercase; }
h1 span { color: var(--accent); }
.sub { color: var(--text-2); margin: 4px 0 0; }
.meta { color: var(--text-3); font-size: 13px; text-align: right; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--text-2); }
.badge.prov { border-color: var(--accent); color: var(--accent-ink); }

.cars { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.car { border-top: 4px solid var(--c); }
.car-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.car-no { font-family: Oswald, sans-serif; font-weight: 600; font-size: 20px; }
.car-no i { font-style: normal; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; }
.drivers { color: var(--text-2); font-size: 13px; }
.hero { display: flex; align-items: baseline; gap: 20px; margin: 10px 0 6px; flex-wrap: wrap; }
.pos { font-size: 64px; line-height: 1; }
.pts { font-size: 28px; line-height: 1; }
.pts small { font-family: Inter, sans-serif; font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts div { font-size: 12px; color: var(--text-3); }
.facts b { display: block; font-family: Oswald, sans-serif; font-weight: 500; font-size: 20px; color: var(--text); }
.verdict { margin-top: 12px; font-size: 14px; color: var(--text-2); }
.verdict strong { color: var(--text); }
.status { font-weight: 600; }
.status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: currentColor; vertical-align: 1px; }

h2 { font-size: 18px; text-transform: uppercase; margin: 0 0 4px; }
.card + .card, .cars + .card { margin-top: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); margin: 4px 0 8px; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 2px; background: var(--c); vertical-align: middle; margin-right: 6px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11px Inter, sans-serif; fill: var(--text-3); }
.chart .lbl { font-weight: 600; fill: var(--text); }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgb(0 0 0 / .15); min-width: 170px; display: none; }
.tip b { display: block; margin-bottom: 4px; }
.tip small { color: var(--text-3); font-size: 11px; }
.tip div { display: flex; justify-content: space-between; gap: 12px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }

.scroll { overflow-x: auto; margin: 8px -20px -20px; padding: 0 20px 12px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-weight: 500; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
th.l, td.l { text-align: left; }
td.team { color: var(--text-2); }
td.team div { color: var(--text-3); font-size: 12px; }
tr.tracked td { background: var(--row-hl); }
tr.tracked td:first-child { box-shadow: inset 4px 0 var(--c); }
td.total { font-weight: 600; }
td.dim { color: var(--text-3); }
th.rnd, td.rnd { color: var(--text-2); min-width: 44px; }
footer { margin-top: 24px; color: var(--text-3); font-size: 12px; }
footer a { color: inherit; }
.err { padding: 40px 20px; text-align: center; color: var(--text-2); }

.live { border: 1px solid var(--accent); margin-bottom: 16px; }
.live-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--text-2); }
.live-head b { color: var(--text); }
.pulse { font-weight: 700; letter-spacing: .08em; color: var(--critical); }
.pulse::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; animation: blink 1.4s infinite; }
.live.done .pulse { color: var(--text-3); }
.live.done .pulse::before { animation: none; }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pulse::before { animation: none; } }
.flag { padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; border: 1px solid var(--f); color: var(--f); }
.ttg { margin-left: auto; font-variant-numeric: tabular-nums; }
.live-verdict { font-family: Oswald, Impact, sans-serif; font-weight: 600; font-size: clamp(22px, 4.5vw, 30px); line-height: 1.15; margin: 12px 0 4px; text-transform: uppercase; }
.live-verdict em { font-style: normal; color: var(--accent-ink); }
.live-sub { margin: 0; color: var(--text-2); font-size: 14px; }
.runners { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 16px 0 4px; }
.runner { border-left: 4px solid var(--c); padding: 2px 0 2px 12px; }
.runner-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.runner-top .num { font-size: 28px; line-height: 1; }
.runner-top small { color: var(--text-3); font-size: 12px; }
.pit { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; background: #eda100; color: #111; }
.runner dl { display: grid; grid-template-columns: repeat(4, auto); gap: 2px 14px; margin: 8px 0 0; font-size: 12px; justify-content: start; }
.runner dt { color: var(--text-3); }
.runner dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; }
.picker { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: -4px 0 16px; }
.picker div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.picker span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-right: 2px; }
.picker a { font: 600 15px Oswald, sans-serif; text-decoration: none; color: var(--text-2); border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 3px 12px; }
.picker a:hover { border-color: var(--text-3); }
.picker a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stint { margin-top: 10px; font-size: 12px; color: var(--text-2); }
.bar { position: relative; height: 8px; border-radius: 4px; background: var(--grid); margin: 6px 0 4px; overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 4px; }
.bar .win { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--critical) 25%, transparent); }
.bar .typ { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--critical); }
.stint b { color: var(--text); font-weight: 600; }
td.stints { color: var(--text-3); font-size: 12px; white-space: normal; min-width: 120px; text-align: left; }
.up { color: var(--good); }
.down { color: var(--critical); }
table.timing td.team div { white-space: nowrap; }
.live .note { color: var(--text-3); font-size: 12px; margin: 10px 0 0; }
@media (max-width: 560px) {
  .meta { text-align: left; }
  .pos { font-size: 52px; }
  .rnd { display: none; }
  td.team { white-space: normal; min-width: 140px; }
  th, td { padding: 7px 5px; }
}

/* page tabs */
.tabs { display: flex; gap: 4px; margin-top: 10px; }
.tabs a { font: 600 13px Inter, sans-serif; text-decoration: none; color: var(--text-2); padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); }
.tabs a[aria-current] { color: var(--text); border-color: var(--text-3); background: var(--surface); }

/* strategy page */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 12px; margin: 14px 0 4px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); min-width: 0; }
.kpi .k { font-size: 12px; color: var(--text-3); }
.kpi .v { font-family: Oswald, Impact, sans-serif; font-weight: 600; font-size: 26px; line-height: 1.15; white-space: nowrap; }
.kpi .v small { font: 500 13px Inter, sans-serif; color: var(--text-3); margin-left: 4px; }
.kpi .s { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.ebar { height: 8px; border-radius: 4px; background: var(--grid); margin-top: 6px; overflow: hidden; }
.ebar i { display: block; height: 100%; border-radius: 4px; background: var(--s1); }
.mini { display: inline-block; width: 46px; height: 6px; border-radius: 3px; background: var(--grid); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--text-3); }
tr.tracked .mini i { background: var(--s1); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 560px) { .charts { grid-template-columns: 1fr; } }
.empty { color: var(--text-3); font-size: 13px; padding: 24px 0; }
.chart .endlbl { font-weight: 600; fill: var(--text); }

.event { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--s4); font-size: 13px; color: var(--text-2); }
.event b { color: var(--text); }
.owes { font-size: 10px; font-weight: 700; color: var(--text-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 4px; }

/* header countdown to the next session / time left in the live one */
.navrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.navrow .tabs { margin-top: 0; }
.countdown { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.countdown[data-state="live"] { color: var(--text); border-color: var(--critical); }
.countdown[data-state="live"]::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--critical); margin-right: 6px; vertical-align: 1px; }
.pace-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.cmp { font-size: 13px; color: var(--text-2); }
.cmp select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; margin-left: 6px; }
.legend span.sw::before { display: none; }
td.fast { font-weight: 700; color: var(--text); }
.chip { font: 600 12px Inter, sans-serif; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; margin-right: 6px; cursor: pointer; }
.chip:hover { border-color: var(--text-3); }
ul.vs { margin: 6px 0 4px; padding-left: 18px; }
ul.vs li { margin: 2px 0; }

/* strategy: session bar above everything, then one row of tiles per compared car */
.sessionbar { background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 16px; margin-bottom: 12px; }
.sessionbar.done { border-color: var(--line); }
.kpirow { margin-top: 14px; padding-left: 10px; border-left: 4px solid var(--c, var(--line)); }
.kpirow .kpis { margin: 4px 0 0; }
.kpirow .who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.kpirow .who b { font: 600 18px Oswald, sans-serif; color: var(--text); }
.kpirow .who small { font-size: 12px; color: var(--text-3); }
.kpirow .who .chip.x { padding: 0 7px; margin-left: 2px; }
.kpirow:not(.mine) .kpi .v { font-size: 21px; }
.kpirow.mine .kpi { border-color: var(--text-3); }
.watch { margin: 8px 0 2px; padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); line-height: 1.6; }
.watch b { color: var(--text); }
td.nowcol { background: var(--row-hl); font-weight: 700; color: var(--text); }
.answer { font-family: Oswald, Impact, sans-serif; font-weight: 600; font-size: clamp(20px, 4vw, 26px); line-height: 1.2; margin: 14px 0 0; text-transform: uppercase; }
.answer em { font-style: normal; color: var(--accent-ink); }
.needs-lines { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; color: var(--text-2); }
.needs-lines li { padding: 5px 0 5px 10px; border-left: 4px solid var(--c, var(--line)); margin-top: 4px; }
.needs-lines b { color: var(--text); }
a.golink { white-space: nowrap; font-weight: 600; color: var(--accent-ink); }
details.more { margin-top: 10px; }
details.more > summary, details.fold > summary, details.deep > summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary::after { content: "Show ▾"; margin-left: auto; font-size: 12px; color: var(--text-3); }
details.fold[open] > summary::after { content: "Hide ▴"; }
details.fold[open] > summary { margin-bottom: 10px; }
details.card { display: block; margin-bottom: 16px; }
.titleline { margin-top: 6px; font-size: 14px; color: var(--text-2); }
.titleline b { color: var(--text); }
.vettes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; font-size: 13px; }
.vettes .vcls { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-left: 6px; }
.vettes a { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); text-decoration: none; }
.vettes a b { color: var(--text); }
.vettes a[aria-current] { border-color: var(--accent); background: var(--row-hl); }
table.ours td.who { white-space: nowrap; }
table.ours td.who b { font: 600 17px Oswald, sans-serif; color: var(--text); }
table.ours td.total { font: 600 17px Oswald, sans-serif; }
.feed { list-style: none; margin: 6px 0 0; padding: 0; font-size: 14px; color: var(--text-2); }
.feed li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.feed li:first-child { border-top: 0; }
.feed .lap { font: 600 13px Oswald, sans-serif; color: var(--text-3); min-width: 34px; }
.linkbtn { margin-top: 8px; background: none; border: 0; padding: 4px 0; color: var(--accent-ink); font: inherit; font-size: 13px; cursor: pointer; }
details.deep > summary { gap: 12px; }
details.deep .card { margin-bottom: 0; }
details.deep[open] > .charts { margin-top: 16px; }
/* theme picker */
.theme { display: inline-flex; margin-left: auto; border: 1px solid var(--line); border-radius: 99px; padding: 2px; background: var(--surface); }
.theme button { font: 600 12px Inter, system-ui, sans-serif; color: var(--text-2); background: none; border: 0; border-radius: 99px; padding: 3px 10px; cursor: pointer; }
.theme button[aria-checked="true"] { background: var(--text); color: var(--bg); }
.theme button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* livery stripe across the top, in the selected car's colours */
.livery-band { height: 6px; background: var(--livery); box-shadow: inset 0 -1px 0 rgba(0,0,0,.12); }
/* drivers */
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 20px; margin-top: 8px; }
.dcar { padding-left: 10px; border-left: 4px solid var(--c, var(--line)); }
.dcar .who { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.dcar .who b { font: 600 17px Oswald, sans-serif; }
.dlist { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14px; }
.dlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.dlist li:first-child { border-top: 0; }
.dlist li.incar .dname { font-weight: 700; }
.dname { flex: 1 1 140px; }
.dtime { font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.rating { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--text-2); }
.rating small { font-weight: 500; margin-left: 4px; color: var(--text-3); }
.rating.r-am { border-color: var(--accent); color: var(--accent-ink); }
.dbar { flex: 1 0 100%; display: block; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.dbar i { display: block; height: 100%; background: var(--s1); }

/* ---- phones: the same pages, pared down to what matters at a glance ---- */
.m-only { display: none; }
@media (max-width: 640px) {
  main { padding: 12px 12px 40px; }
  header { margin-bottom: 10px; }
  h1 { font-size: 26px; }
  .sub, .meta { display: none; }
  .navrow { gap: 6px; margin-top: 8px; }
  .tabs { gap: 3px; }
  .tabs a { padding: 3px 9px; font-size: 12px; }
  .countdown { font-size: 11px; padding: 2px 8px; }
  .theme { margin-left: 0; }
  .theme button { padding: 2px 7px; font-size: 11px; }
  /* car picker: one swipeable row */
  .picker { flex-wrap: nowrap; overflow-x: auto; gap: 14px; margin: 0 -12px 12px; padding: 0 12px 4px; scrollbar-width: none; }
  .picker div { flex-wrap: nowrap; }
  .picker a { padding: 3px 10px; }
  .card { padding: 14px; }
  .m-only { display: inline; }
  .m-hide { display: none !important; }
  /* tables: keep the columns that matter, let the rest go */
  td.team div { display: none; }
  #table .rnd { display: none; }
  #recap th:nth-child(3), #recap td:nth-child(3), #recap th:nth-child(4), #recap td:nth-child(4) { display: none; }
  #proj-card th:nth-child(3), #proj-card td:nth-child(3), #proj-card th:nth-child(5), #proj-card td:nth-child(5) { display: none; }
  #ours th:nth-child(4), #ours td:nth-child(4), #ours th:nth-child(6), #ours td:nth-child(6), #ours th:nth-child(8), #ours td:nth-child(8) { display: none; }
  #ours .role { display: none; }
  #timing th:nth-child(4), #timing td:nth-child(4), #timing th:nth-child(7), #timing td:nth-child(7),
  #timing th:nth-child(8), #timing td:nth-child(8), #timing th:nth-child(9), #timing td:nth-child(9), #timing th:nth-child(10), #timing td:nth-child(10) { display: none; }
  th, td { padding-left: 6px; padding-right: 6px; }
  /* pit strategy: only the selected car's tiles, two per row */
  .kpirow:not(.mine) { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 8px 10px; }
  .kpi .v { font-size: 22px; }
  .watch .dim { display: none; }
  .answer { font-size: 20px; }
  .needs-lines { font-size: 13px; }
  .facts b { font-size: 17px; }
  .live-verdict { font-size: 20px; }
  .dgrid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  #ours td .dim, #ours td.who svg { display: none; }
  #ours td.who { border-left: 3px solid var(--c); }
  .picker span { white-space: nowrap; }
}
@media (max-width: 640px) {
  td.team { min-width: 90px; }
  #timing td.team { min-width: 0; }
}
.needs-mode { margin-top: 14px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.needs-mode:empty { display: none; }
.needs-mode + #answer .answer { margin-top: 2px; }

/* ---- Race tab layout: one column on phones and laptops, two on wide screens ---- */
.race-grid { display: flex; flex-direction: column; }
.race-grid .col { display: contents; }
/* Phone (one column): the default order, by time horizon. A saved Arrange layout overrides it. */
#ours-card { order: 1; } #feed-card { order: 2; } #pn-card { order: 3; } #cars-card { order: 4; } #fin-card { order: 5; } #drivers-card { order: 6; } #rc-card { order: 7; }
#wx-card { order: 8; } #timing-card { order: 9; } #builder-card { order: 10; } #pa-card { order: 11; } #sector-card { order: 12; } #map-card { order: 13; } #watch-card { order: 14; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; margin-top: 8px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wlabel { margin-top: 6px; }
@media (min-width: 1280px) {
  body.race main { max-width: min(1760px, 96vw); }
  .race-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  .race-grid .col { display: block; }
  body.race .charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1700px) {
  .race-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}

/* chart builder */
.bchart { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.bchart:first-child { border-top: 0; margin-top: 4px; padding-top: 0; }
.bctl { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.bctl select { font: 500 13px Inter, sans-serif; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.bctl .b-metric { font-weight: 600; }
.bseg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 2px; background: var(--bg); }
.bseg button { font: 600 12px Inter, sans-serif; color: var(--text-2); background: none; border: 0; border-radius: 99px; padding: 3px 9px; cursor: pointer; }
.bseg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.bchk { font-size: 12px; color: var(--text-2); display: inline-flex; gap: 4px; align-items: center; }
.bhelp { font-size: 12px; margin: 6px 0 2px; }
.bandkey { display: inline-block; width: 14px; height: 10px; background: var(--flag-yellow); opacity: .35; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 640px) { .bctl select, .bseg button { font-size: 11px; } }
/* card fold toggle */
.card-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.card-head > h2 { margin-right: auto; }
.card-head.pace-head > :first-child { margin-right: auto; }
.fold-btn { font: 600 11px Inter, sans-serif; color: var(--text-3); background: none; border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; cursor: pointer; }
.fold-btn:hover { color: var(--text); border-color: var(--text-3); }
.card.collapsed > :not(.card-head) { display: none !important; }
.card.collapsed { padding-bottom: 12px; }
/* pit strategy table */
table.pittable td .sub { font-size: 11px; color: var(--text-3); line-height: 1.2; }
table.pittable td.who { white-space: nowrap; }
table.pittable td.who b { font: 600 17px Oswald, sans-serif; color: var(--text); }
table.pittable .mini { margin-right: 4px; }
@media (max-width: 640px) { table.pittable td.who svg, table.pittable .role { display: none; } table.pittable td.who { border-left: 3px solid var(--c); } }
@media (min-width: 1280px) { #ours .dn { display: none; } }

/* centred header and car picker */
header { flex-direction: column; align-items: center; text-align: center; }
header .meta { text-align: center; }
.navrow { justify-content: center; }
.picker { justify-content: center; align-items: center; }
.picker > .pick-title { flex-basis: 100%; text-align: center; margin: 0 0 -2px; }
@media (max-width: 640px) {
  .picker { flex-wrap: wrap; overflow-x: visible; gap: 8px 14px; margin: 0 0 12px; padding: 0; }
  .picker div { flex-wrap: wrap; justify-content: center; }
}
/* IMSA and team links under the picker */
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: -6px 0 16px; font-size: 12px; }
.links .lgrp { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; justify-content: center; }
.links b { font-weight: 600; color: var(--text-2); }
.links a { color: var(--text-3); text-decoration: none; }
.links a:hover { color: var(--accent-ink); text-decoration: underline; }
.links { column-gap: 26px; }
@media (max-width: 640px) { .links .lgrp + .lgrp { border-left: 0; padding-left: 0; } .links { gap: 6px 12px; } }
.links .socials { gap: 4px 16px; }
.links .socials .lbl { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.links .team { display: inline-flex; align-items: center; gap: 6px; }
.links a.ico { display: inline-flex; color: var(--text-2); padding: 2px; border-radius: 6px; }
.links a.ico:hover { color: var(--accent-ink); background: var(--row-hl); text-decoration: none; }
/* bottom links: repo, Instagram, contact */
.footlinks { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin-top: 14px; font-size: 13px; }
.footlinks a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; }
.footlinks a:hover { color: var(--accent-ink); }
/* anonymous profile: button in the tab row and its panel */
.acct-btn { font: 600 12px Inter, sans-serif; color: var(--text-2); background: none; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; cursor: pointer; }
.acct-btn:hover { color: var(--text); border-color: var(--text-3); }
dialog.acct { max-width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
dialog.acct::backdrop { background: rgb(0 0 0 / .5); }
dialog.acct h2 { margin: 0 0 8px; font-size: 18px; }
dialog.acct p { color: var(--text-2); font-size: 14px; margin: 8px 0; }
dialog.acct .acct-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
dialog.acct input { flex: 1 1 220px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
dialog.acct .acct-main { font: 600 13px Inter, sans-serif; padding: 7px 14px; border-radius: 99px; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer; }
dialog.acct .acct-code { font: 600 15px ui-monospace, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; user-select: all; }
dialog.acct .chip.danger { border-color: var(--critical); color: var(--critical); }
dialog.acct .acct-msg { min-height: 1.2em; color: var(--text); }
dialog.acct .acct-msg.bad { color: var(--critical); }
dialog.acct form[method="dialog"] { text-align: right; margin-top: 4px; }
/* live position on the picker buttons (Race tab) */
.picker a .ppos { font: 500 12px Inter, sans-serif; margin-left: 5px; opacity: .8; }
.picker a .pit { margin-left: 5px; font: 700 10px Inter, sans-serif; letter-spacing: .02em; padding: 1px 5px; line-height: 1.4; vertical-align: 2px; color: #111; }
/* session bar: centred like the header */
.sessionbar { text-align: center; }
.sessionbar .live-head { justify-content: center; }
.sessionbar .ttg { margin-left: 0; }
.sessionbar .ttg::before { content: "· "; color: var(--text-3); }
.dev-badge { position: fixed; top: 10px; left: 10px; z-index: 50; font: 700 12px Inter, sans-serif; letter-spacing: .08em; padding: 3px 10px; border-radius: 6px; background: #d03b3b; color: #fff; }
/* race control */
.rclist { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; max-height: 520px; overflow-y: auto; }
.rclist li { display: grid; grid-template-columns: 62px 92px 1fr; gap: 8px; align-items: baseline; padding: 5px 0 5px 6px; border-top: 1px solid var(--line); border-left: 3px solid transparent; }
.rclist li:first-child { border-top: 0; }
.rclist li.mine { border-left-color: var(--c); background: var(--row-hl); }
.rctime { font: 500 12px Inter, sans-serif; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rctag { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.rc-penalty .rctag, .rctag.rc-penalty { color: var(--critical); }
.rc-warning .rctag, .rctag.rc-warning { color: var(--flag-yellow); }
.rc-review .rctag, .rctag.rc-review { color: var(--s2); }
.rc-decision .rctag, .rctag.rc-decision { color: var(--text-2); }
.rclist .rccar { color: var(--text); }
.rclist .rc-flag .rctext, .rclist .rc-info .rctext, .rclist .rc-pit .rctext { color: var(--text-2); }
@media (max-width: 640px) { .rclist li { grid-template-columns: 54px 1fr; } .rclist .rctag { grid-column: 2; } .rclist .rctext { grid-column: 1 / -1; } }
/* current track outline behind everything: small staggered tiles in the livery colour */
.track-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--accent); opacity: .07;
  -webkit-mask-size: 160px 261px; mask-size: 160px 261px; -webkit-mask-position: 0 0; mask-position: 0 0;
  -webkit-mask-repeat: repeat; mask-repeat: repeat; }
.footlinks .osm { color: var(--text-3); font-size: 12px; }
.footlinks .osm a { color: var(--text-3); }
/* let the track outline show faintly through the cards */
.card, .sessionbar { background: color-mix(in srgb, var(--surface) 88%, transparent); }
:root[data-theme="dark"] .track-bg { opacity: .10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .track-bg { opacity: .10; } }
/* track map */
.trackmap { display: block; width: 100%; max-height: 520px; margin-top: 6px; }
.trackmap .map-track { fill: none; stroke: var(--line); stroke-width: 26; stroke-linejoin: round; }
.trackmap .sf { fill: var(--text-3); }
.trackmap .sflbl { font: 700 34px Inter, sans-serif; fill: var(--text-3); }
.trackmap .mapdot { fill: var(--text-3); opacity: .75; }
.trackmap .maplbl { font: 700 38px Inter, sans-serif; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 8px; }
.rc-live { font-size: 12px; margin-left: auto; }
/* picker sections: Pratt Miller Motorsports, Other cars, This is my car */
.picker { flex-direction: column; align-items: center; gap: 10px; }
.picker .pick-sec { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.picker .pick-sec > .pick-title { flex-basis: auto; margin: 0; }
.picker .pick-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.picker .pick-any select { font: 600 13px Inter, sans-serif; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; max-width: min(360px, 90vw); }
.picker .pick-any.active select { border-color: var(--accent); background: var(--row-hl); }
.tagline { margin: 2px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
/* friendly rivalry */
.enemy { font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--critical); white-space: nowrap; }
.snark { color: var(--text-3); }
.lookaway { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.picker .allow { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }
.picker .allow .linkbtn { margin: 0 0 0 6px; padding: 0; font-size: 12px; }
.qnote { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.qnote b { color: var(--flag-yellow); }
/* weather */
.wxstrip { display: flex; gap: 4px; overflow-x: auto; padding: 6px 0 4px; scrollbar-width: thin; }
.wxh { flex: 0 0 auto; min-width: 54px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 8px; border: 1px solid var(--line); font-size: 12px; }
.wxh.race { border-color: var(--accent); }
.wxh.wet { background: color-mix(in srgb, var(--s2) 12%, transparent); }
.wxh .wxt { color: var(--text-3); font-size: 11px; }
.wxh .wxi { font-size: 18px; line-height: 1.1; }
.wxh .wxr { font-size: 11px; color: var(--text-2); background: linear-gradient(to right, color-mix(in srgb, var(--s2) 35%, transparent) var(--p), transparent var(--p)); border-radius: 4px; padding: 0 4px; }
.wxh3 { font: 600 13px Inter, sans-serif; margin: 12px 0 4px; color: var(--text-2); }
.wxtl, .wxfits { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.wxtl li { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.wxtl li:first-child { border-top: 0; }
.wxtl .wxwhen { font: 600 12px Inter, sans-serif; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wxtl .wx-rain .wxwhat b:first-child { color: var(--s2); }
.wxtl .wxstop { color: var(--accent-ink); }
.wxfits li { padding: 3px 0; }
/* arranging cards */
body.arranging [data-layout] { min-height: 80px; outline: 1px dashed var(--line); outline-offset: 4px; border-radius: 12px; }
body.arranging [data-layout] > .card { cursor: grab; }
body.arranging .card.dragging { opacity: .45; }
.arrange-ctl { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin: -6px -6px 8px 0; }
.arrange-ctl .grip { margin-right: auto; color: var(--text-3); font-size: 16px; cursor: grab; }
.arrange-ctl button, .arrange-bar button { font: 600 12px Inter, sans-serif; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; cursor: pointer; }
.arrange-ctl button:hover, .arrange-bar button:hover { border-color: var(--accent); }
.arrange-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 8px 30px rgb(0 0 0 / .35); font-size: 13px; max-width: calc(100vw - 24px); }
.arrange-bar .copied { color: var(--good); font-weight: 600; }
.champ-cards { display: flex; flex-direction: column; }
/* pace analysis */
#pa-drivers svg { display: block; width: 100%; height: auto; }
#pa-drivers text { font: 11px Inter, sans-serif; fill: var(--text-3); }
#pa-drivers text.lbl { font-weight: 600; fill: var(--text); }
table.pacemap { border-collapse: separate; border-spacing: 2px; font-size: 11px; }
table.pacemap th { font-weight: 600; color: var(--text-3); padding: 2px 4px; }
table.pacemap td { text-align: center; padding: 3px 5px; border-radius: 4px; color: var(--text); font-variant-numeric: tabular-nums; min-width: 34px; }
table.pacemap td:first-child { text-align: left; font-weight: 600; background: none; }
table.pacemap tr.tracked td:first-child { color: var(--accent-ink); }
table.pacemap td.pm-empty { background: var(--grid); opacity: .4; }
.pm-key { padding: 0 6px; border-radius: 4px; font-weight: 600; }
.pm-key.q { background: color-mix(in srgb, var(--s2) 70%, var(--grid)); }
.pm-key.s { background: color-mix(in srgb, var(--s4) 70%, var(--grid)); }
@media (max-width: 640px) { #ours th:nth-child(9), #ours td:nth-child(9) { display: none; } }

/* Race prediction */
table.predtab { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.predtab th { font-size: 11px; color: var(--text-3); font-weight: 600; padding: 4px 6px; text-align: right; white-space: nowrap; }
table.predtab td { padding: 5px 6px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.predtab .l { text-align: left; }
table.predtab td:first-child { font-weight: 600; text-align: left; }
table.predtab td.dim { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
table.predtab tr.me td { background: var(--row-hl); }
table.predtab tr.me td:first-child, table.predtab tr.tracked td:first-child { color: var(--accent-ink); }
.pstrip { display: inline-flex; gap: 1px; vertical-align: middle; }
.pstrip i { display: block; width: 9px; height: 14px; border-radius: 2px; background: var(--accent); }
ul.oddsbars { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; gap: 6px; }
ul.oddsbars li { display: grid; grid-template-columns: 48px 1fr 52px; gap: 8px; align-items: center; font-size: 13px; font-variant-numeric: tabular-nums; }
ul.oddsbars li span:last-child { text-align: right; }
ul.oddsbars .bar { height: 10px; background: var(--grid); border-radius: 4px; overflow: hidden; }
ul.oddsbars .bar i { display: block; height: 100%; background: var(--text-3); border-radius: 4px; }
ul.oddsbars li.me .bar i { background: var(--accent); }
ul.oddsbars li.me b { color: var(--accent-ink); }

/* Caution history */
.cauhours { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; align-items: end; }
.cauhours div { display: grid; grid-template-rows: auto 56px auto; row-gap: 2px; text-align: center; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cauhours .bar { height: 56px; display: flex; align-items: flex-end; background: var(--grid); border-radius: 4px; overflow: hidden; }
.cauhours .bar i { display: block; width: 100%; background: var(--flag-yellow); border-radius: 4px 4px 0 0; }
.cauhours .now { color: var(--text); font-weight: 600; }
.cauhours .now .bar { outline: 2px solid var(--text); outline-offset: 1px; }
table.cauheat { width: auto; border-collapse: separate; border-spacing: 1px; font-size: 10px; }
table.cauheat th { color: var(--text-3); font-weight: 600; padding: 0 4px; text-align: right; white-space: nowrap; }
table.cauheat thead th { position: relative; padding: 0; height: 14px; }
table.cauheat thead th span { position: absolute; left: 0; bottom: 1px; font-weight: 600; }
table.cauheat td { width: 9px; min-width: 9px; height: 14px; border-radius: 2px; padding: 0; }
table.cauheat td.off { background: none; }
table.cauheat td.now { outline: 2px solid var(--text); outline-offset: -1px; }
table.cauheat tr.often th { color: var(--text); }
table.cauheat tr.often td { height: 18px; }
.cauhours div > span { display: block; }
.cauhours .h { margin-top: 3px; }

/* Pit wall strip: the selected car at a glance (Race tab, above the cards) */
.pitwall { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; }
.pwgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px 14px; }
.pwt { display: flex; flex-direction: column; min-width: 0; }
.pwt .k { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.pwt b { font-family: Oswald, sans-serif; font-weight: 500; font-size: 22px; line-height: 1.15; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwt.big b { font-size: 30px; color: var(--accent-ink); }
.pwt .s { font-size: 12px; color: var(--text-2); }
.pwt.warn b, .pwt.warn .s { color: var(--critical); }
.pwline { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text); }
@media (max-width: 1100px) { .pwgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pwgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pwt.big { grid-column: span 2; } }

/* If we pit now */
.pnrow { padding: 8px 0; border-top: 1px solid var(--line); }
.pnrow:first-child { border-top: 0; }
.pnhead { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 13px; }
.pnpos { font-family: Oswald, sans-serif; font-size: 20px; color: var(--accent-ink); }
.pnaround { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13px; align-items: baseline; }
.pncar { font-weight: 600; }
.pnme { font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 6px; padding: 1px 8px; }
.pncaution { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }

/* To the flag; drive-time risk */
.tag.est { font-size: 10px; font-weight: 600; color: var(--text-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.dwarn { color: var(--critical); font-weight: 600; }
.dbar.risk-plan i { background: var(--flag-yellow); }
.dbar.risk-urgent i, .dbar.risk-impossible i { background: var(--critical); }
.dlist .d6 { flex-basis: 100%; font-size: 11px; }

/* Race tab views: Fan / Strategy */
.modebar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: center; margin: 0 0 10px; font-size: 13px; }
.race-grid section.card.mode-off { display: none !important; }
body.mode-fan #pw { display: none !important; }
body.mode-fan .sv-wide { display: none !important; }
.sgwx { font-size: 10px; fill: var(--text-2); }
#sg-chart .tip { min-width: 150px; }
