/* PitWall — pit wall monitor theme
   One family (Archivo, variable width). Condensed for figures, normal for reading.
   Colour means something: team colour = identity, purple = best, red = live. */

:root {
  --bg: #0f1722;
  --rail: #0c131c;
  --surface: #152030;
  --surface-2: #1a2738;
  --line: #22324a;
  --line-soft: #1c2a3d;
  --text: #eaf0f6;
  --muted: #8c9bb0;
  --dim: #5d6c82;
  --red: #ff2a1f;
  --purple: #b07bff;
  --green: #35d58a;
  --amber: #f2b84b;

  --font: "Archivo", "Segoe UI", system-ui, sans-serif;
  --narrow: 72%;

  --r-tile: 14px;
  --r-ctl: 8px;
  --gap: 12px;
  --rail-w: 224px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

body {
  min-height: 100dvh;
}

button,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 40;
  background: var(--text);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: var(--r-ctl);
}

/* ---------- Shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100dvh;
  transition: grid-template-columns 0.2s ease;
}

body.nav-collapsed {
  --rail-w: 68px;
}

.nav-drawer {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
  padding: 18px 14px 16px;
  background: var(--rail);
  overflow: hidden;
}

.drawer-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

/* The mark is a start light: red over a dark gantry */
.nav-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  font-stretch: var(--narrow);
  letter-spacing: 0.02em;
}

.brand-copy {
  min-width: 0;
}

.nav-drawer h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
  font-stretch: var(--narrow);
  letter-spacing: -0.01em;
  line-height: 1;
}

.nav-drawer .eyebrow {
  margin: 3px 0 0;
  color: var(--dim);
  font-size: 0.75rem;
  line-height: 1.2;
}

.nav-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--dim);
  background: transparent;
  border: 0;
  border-radius: var(--r-ctl);
  cursor: pointer;
}

.nav-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-toggle svg {
  transition: transform 0.2s ease;
}

body.nav-collapsed .nav-toggle svg {
  transform: rotate(180deg);
}

.view-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.view-nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r-ctl);
  cursor: pointer;
}

.view-nav button:hover {
  color: var(--text);
  background: var(--surface);
}

.view-nav button.is-active {
  color: var(--text);
  background: var(--surface);
}

.view-nav button.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--red);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.drawer-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.freshness {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  column-gap: 8px;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  min-height: 1.4em;
}

.freshness::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
  transform: translateY(-1px);
}

body.is-loading .freshness::before {
  background: var(--dim);
  box-shadow: none;
}

.freshness.checking:not(.stale) .freshness-note {
  color: var(--muted);
}

.freshness.checking::before {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.freshness.stale::before {
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent);
}

.freshness-line,
.freshness-note {
  grid-column: 2;
}

.freshness-note {
  margin-top: 4px;
  color: var(--amber);
}

.source-note {
  margin: 0;
  color: var(--dim);
  font-size: 0.72rem;
  line-height: 1.4;
}

body.nav-collapsed .brand-copy,
body.nav-collapsed .nav-label,
body.nav-collapsed .source-note,
body.nav-collapsed .freshness-line,
body.nav-collapsed .freshness-note {
  display: none;
}

body.nav-collapsed .drawer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.nav-collapsed .view-nav button {
  justify-content: center;
  padding: 10px;
}

body.nav-collapsed .freshness {
  display: flex;
  justify-content: center;
}

/* ---------- Main ---------- */

main {
  min-width: 0;
  padding: var(--gap);
}

.stage[hidden] {
  display: none !important;
}

.banner {
  margin: 0 0 var(--gap);
  padding: 10px 14px;
  border-radius: var(--r-ctl);
  background: color-mix(in srgb, var(--amber) 12%, var(--surface));
  color: var(--amber);
  font-size: 0.9rem;
}

.banner[hidden] {
  display: none;
}

.bento {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--gap);
}

.tile {
  min-width: 0;
  min-height: 0;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--r-tile);
}

.tile-weekend { grid-column: 1; grid-row: 1; }
.tile-podium  { grid-column: 2; grid-row: 1; }
.tile-drivers { grid-column: 1; grid-row: 2; }
.tile-teams   { grid-column: 2; grid-row: 2; }

.tile h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.panel-meta {
  margin: 0;
  color: var(--dim);
  font-size: 0.8rem;
  text-align: right;
}

.tile-drivers .panel-head,
.tile-teams h2 {
  margin-bottom: 12px;
}

/* ---------- Hero: next Grand Prix ---------- */

.tile-weekend {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% 50%, color-mix(in srgb, var(--red) 7%, transparent), transparent 60%),
    var(--surface);
}

.next-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 6px;
}

.next-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.meeting-name {
  margin: 0;
  font-size: clamp(2rem, 3.1vw, 2.9rem);
  font-weight: 750;
  font-stretch: var(--narrow);
  letter-spacing: -0.015em;
  line-height: 0.98;
  text-wrap: balance;
}

.meeting-place {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.meeting-circuit {
  margin: 0;
  color: var(--dim);
  font-size: 0.85rem;
}

.meeting-circuit:empty {
  display: none;
}

.countdown {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin: 18px 0 14px;
}

.count-block {
  display: flex;
  flex-direction: column;
}

.count-block span {
  font-size: clamp(2.2rem, 3.4vw, 3.1rem);
  font-weight: 650;
  font-stretch: var(--narrow);
  line-height: 0.9;
  letter-spacing: -0.01em;
}

.count-block small {
  margin-top: 6px;
  color: var(--dim);
  font-size: 0.75rem;
}

.count-block + .count-block {
  position: relative;
}

.count-block.is-seconds span {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  padding: 5px 0;
  text-align: left;
  border-top: 1px solid var(--line-soft);
}

th {
  padding-top: 0;
  border-top: 0;
  color: var(--dim);
  font-size: 0.75rem;
  font-weight: 500;
}

th:nth-child(2),
td:nth-child(2) {
  text-align: right;
}

th:nth-child(3),
td:nth-child(3) {
  display: none;
}

tbody tr:last-child td {
  color: var(--text);
  font-weight: 650;
}

td {
  color: var(--muted);
}

td:first-child {
  color: var(--text);
}

/* Circuit map with a light lapping the track */
.next-track-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 240px;
}

.next-track-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  overflow: visible;
}

.track-ribbon {
  fill: none;
  stroke: var(--line);
  stroke-width: 11;
  stroke-linejoin: round;
}

.track-line {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 55%, transparent);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.track-light {
  fill: none;
  stroke: var(--red);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 70 930;
  filter: drop-shadow(0 0 5px var(--red));
  animation: lap 9s linear infinite;
}

.track-start {
  stroke: var(--text);
  stroke-width: 3;
}

.track-name,
.track-missing {
  margin: 10px 0 0;
  color: var(--dim);
  font-size: 0.8rem;
  text-align: center;
}

@keyframes lap {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

/* ---------- Latest race ---------- */

.tile-podium {
  display: flex;
  flex-direction: column;
}

.podium {
  list-style: none;
  flex: 1;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  margin: 12px 0 0;
  padding: 0;
}

.podium li {
  position: relative;
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-content: center;
  padding: 12px 0 12px 14px;
  border-top: 1px solid var(--line-soft);
}

.podium li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 2px;
  background: var(--team, var(--line));
  transform: scaleY(var(--rise, 1));
  transform-origin: bottom;
}

.podium li:first-child {
  border-top: 0;
}

.podium .pos {
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--dim);
  font-size: 2.6rem;
  font-weight: 750;
  font-stretch: var(--narrow);
  line-height: 1;
}

.podium li:first-child .pos {
  color: var(--text);
}

.podium .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

.podium .first {
  color: var(--muted);
  font-size: 0.9rem;
}

.podium .last {
  font-size: 1.3rem;
  font-weight: 700;
  font-stretch: var(--narrow);
}

.podium .team {
  margin-top: 3px;
  color: var(--team, var(--muted));
  font-size: 0.8rem;
  font-weight: 500;
}

.podium-empty {
  display: block !important;
  color: var(--muted);
}

.podium-empty::before,
.podium .skeleton-card::before {
  display: none;
}

/* ---------- Standings ---------- */

.tile-drivers,
.tile-teams {
  display: flex;
  flex-direction: column;
}

/* Tables fill the tile: columns split, rows stretch to the height */
.standings {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  column-gap: 28px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.standings-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.standings-head,
.standings-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) 2.8rem 3rem;
  gap: 10px;
  align-items: center;
}

.standings-head {
  padding-bottom: 4px;
  color: var(--dim);
  font-size: 0.72rem;
}

.standings-head span:nth-last-child(-n + 2),
.standings-pts,
.standings-gap {
  text-align: right;
}

.standings-list {
  list-style: none;
  flex: 1;
  display: grid;
  min-height: 0;
  max-height: calc(var(--rows, 11) * 38px);
  grid-template-rows: repeat(var(--rows, 11), minmax(22px, 1fr));
  margin: 0;
  padding: 0;
}

.standings-row {
  border-top: 1px solid var(--line-soft);
  font-size: 0.85rem;
}

.standings-row:hover {
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.standings-pos {
  color: var(--dim);
  font-weight: 600;
}

.standings-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-pip {
  display: inline-block;
  flex: 0 0 auto;
  width: 4px;
  height: 14px;
  border-radius: 2px;
}

.standings-primary {
  flex: 0 0 auto;
  font-weight: 600;
}

.standings-secondary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
  font-size: 0.78rem;
}

.standings-name:not(:has(.standings-secondary)) .standings-primary {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standings-pts {
  font-weight: 650;
}

.standings-gap {
  color: var(--dim);
  font-size: 0.78rem;
}

.standings-row.is-leader .standings-pos,
.standings-row.is-leader .standings-primary {
  color: var(--text);
}

.stint-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Compare drivers ---------- */

.tile-battle .panel-head {
  display: block;
  margin-bottom: 18px;
}

.tile-battle h2 {
  color: var(--text);
  font-size: 1.9rem;
  font-weight: 750;
  font-stretch: var(--narrow);
  letter-spacing: -0.01em;
  line-height: 1;
}

.tile-battle .panel-meta {
  margin-top: 6px;
  color: var(--muted);
  text-align: left;
  font-size: 0.9rem;
}

/* Season head-to-head */

.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.season-duel {
  position: relative;
  padding-bottom: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.race-label {
  margin-bottom: 12px;
}

.duel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
}

.duel-pickers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.duel-pickers label {
  position: relative;
  display: flex;
  align-items: center;
}

.duel-key {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 0;
  border-top: 2px solid var(--team, var(--muted));
  pointer-events: none;
}

.duel-key.is-dashed {
  border-top-style: dashed;
}

.duel-pickers select {
  appearance: none;
  min-width: 0;
  max-width: 230px;
  padding: 7px 30px 7px 32px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%238c9bb0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center,
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  font-size: 0.85rem;
  cursor: pointer;
}

.duel-pickers select:hover {
  border-color: var(--dim);
}

.duel-vs {
  color: var(--dim);
  font-size: 0.8rem;
}

.duel-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0 10px;
}

.duel-stats div {
  min-width: 0;
}

.duel-stats dt {
  color: var(--dim);
  font-size: 0.75rem;
}

.duel-stats dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  margin: 2px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-stretch: var(--narrow);
}

.duel-stats small {
  flex-basis: 100%;
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 400;
  font-stretch: 100%;
}

.duel-pip {
  align-self: center;
  width: 4px;
  height: 14px;
  border-radius: 2px;
}

.duel-chart {
  height: 260px;
}

/* No history in the snapshot: hide the pickers and collapse the chart box. */
.season-duel.is-unavailable .duel-pickers {
  display: none;
}

.season-duel.is-unavailable .duel-chart {
  height: auto;
  margin-top: 12px;
}

.season-duel.is-unavailable .empty-hint {
  padding: 20px 16px;
}

.duel-chart svg {
  display: block;
  overflow: visible;
  touch-action: pan-y;
}

.duel-skeleton {
  height: 100%;
  border-radius: var(--r-ctl);
}

.duel-grid line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.duel-grid text {
  fill: var(--dim);
  font-size: 11px;
}

.duel-band {
  opacity: 0.14;
}

.duel-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.duel-line.is-dashed {
  stroke-dasharray: 6 5;
}

.duel-end {
  stroke: var(--surface);
  stroke-width: 2;
}

.duel-label {
  fill: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.duel-cross {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.duel-tip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 10px 12px;
  margin-left: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.8rem;
  pointer-events: none;
}

.duel-tip[hidden] {
  display: none;
}

.duel-tip.is-flipped {
  transform: translateX(calc(-100% - 28px));
}

.duel-tip strong {
  color: var(--muted);
  font-weight: 600;
}

.duel-tip span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.duel-tip i {
  width: 4px;
  height: 12px;
  border-radius: 2px;
}

.duel-tip b {
  margin-left: auto;
  padding-left: 12px;
}

.duel-tip-gap {
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
}

.compare-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.compare-add label {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.compare-add select {
  appearance: none;
  width: 100%;
  padding: 10px 34px 10px 12px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%238c9bb0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center,
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  font-size: 0.9rem;
}

.compare-add select:hover {
  border-color: var(--dim);
}

.compare-add button {
  padding: 10px 18px;
  color: #fff;
  font-weight: 650;
  background: var(--red);
  border: 0;
  border-radius: var(--r-ctl);
  cursor: pointer;
}

.compare-add button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 85%, white);
}

.compare-add button:disabled {
  color: var(--dim);
  background: var(--surface-2);
  cursor: not-allowed;
}

.compare-note {
  margin: 0 0 12px;
  color: var(--amber);
  font-size: 0.85rem;
}

.empty-hint {
  margin: 0;
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-tile);
}

.empty-hint[hidden],
.compare-board[hidden],
.compare-note[hidden] {
  display: none !important;
}

.compare-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--gap);
  align-content: start;
}

.compare-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  background: var(--surface-2);
  border-radius: 12px;
  box-shadow: inset 0 3px 0 var(--team, var(--line));
}

.compare-card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.compare-card-head .team-pip {
  display: none;
}

.compare-identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.compare-acronym {
  color: var(--team, var(--muted));
  font-size: 0.8rem;
  font-weight: 700;
}

.compare-name {
  font-size: 1.3rem;
  font-weight: 700;
  font-stretch: var(--narrow);
  line-height: 1.1;
}

.compare-race {
  margin-top: 2px;
  color: var(--dim);
  font-size: 0.8rem;
}

.compare-remove {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: var(--dim);
  font-size: 0.78rem;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.compare-retry {
  align-self: flex-start;
  padding: 6px 12px;
  color: var(--text);
  font-size: 0.82rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  cursor: pointer;
}

.compare-retry:hover {
  border-color: var(--muted);
}

.compare-remove:hover {
  color: var(--text);
  background: var(--surface);
}

.compare-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
}

.compare-facts div {
  min-width: 0;
}

.compare-facts dt {
  color: var(--dim);
  font-size: 0.75rem;
}

.compare-facts dd {
  margin: 2px 0 0;
  font-size: 1.6rem;
  font-weight: 650;
  font-stretch: var(--narrow);
  line-height: 1.1;
}

/* Purple = best, the way timing screens mark it */
.compare-facts dd.is-best {
  color: var(--purple);
}

.compare-tyres-label {
  margin: 0 0 -8px;
  color: var(--dim);
  font-size: 0.75rem;
}

.compare-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.stint-track {
  display: flex;
  gap: 2px;
  height: 26px;
}

.stint-seg {
  display: flex;
  align-items: center;
  min-width: 34px;
  padding: 0 7px;
  overflow: hidden;
  color: #10151d;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 4px;
}

.stint-seg:first-child { border-radius: 6px 4px 4px 6px; }
.stint-seg:last-child  { border-radius: 4px 6px 6px 4px; }

.stint-seg.is-dark {
  color: #f3f4f6;
}

.stint-track:has(.stint-empty) {
  height: auto;
}

/* ---------- Loading ---------- */

.skeleton {
  display: block;
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}

.skeleton-text { width: min(220px, 70%); height: 0.85em; }
.skeleton-text-wide { width: min(200px, 90%); height: 0.85em; }
.skeleton-text-narrow { width: 72px; height: 0.7em; }
.skeleton-title { width: min(280px, 80%); height: 1.8em; margin: 4px 0; }
.skeleton-bar { height: 12px; width: 100%; border-radius: 4px; }

.skeleton-chart {
  display: grid;
  gap: 18px;
  padding-top: 8px;
}

.skeleton-chart .skeleton-bar:nth-child(1) { width: 92%; }
.skeleton-chart .skeleton-bar:nth-child(2) { width: 78%; }
.skeleton-chart .skeleton-bar:nth-child(3) { width: 71%; }
.skeleton-chart .skeleton-bar:nth-child(4) { width: 58%; }
.skeleton-chart .skeleton-bar:nth-child(5) { width: 49%; }
.skeleton-chart .skeleton-bar:nth-child(6) { width: 33%; }

.skeleton-card {
  display: grid !important;
  gap: 8px;
}

.skeleton-row td {
  border: 0;
}

.sheen-text {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  background-image: linear-gradient(100deg, var(--dim) 36%, var(--text) 50%, var(--dim) 64%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.6s linear infinite;
}

.load-pill {
  display: none;
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

body.is-loading .load-pill {
  display: block;
}

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -20% 0; }
}

/* ---------- Desktop: one screen, no page scroll ---------- */

@media (min-width: 900px) {
  html,
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell,
  .nav-drawer,
  main {
    height: 100dvh;
  }

  main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .bento {
    flex: 1;
    min-height: 0;
  }

  .tile-battle {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 24px;
  }
}

/* ---------- Short screens (13" laptops) ---------- */

@media (min-width: 900px) and (max-height: 820px) {
  .tile {
    padding: 14px 18px;
  }

  .meeting-name {
    font-size: 2rem;
  }

  .countdown {
    margin: 12px 0 10px;
  }

  .count-block span {
    font-size: 2.2rem;
  }

  th,
  td {
    padding: 3px 0;
  }

  .next-track-wrap {
    min-height: 0;
  }

  .next-track-wrap svg {
    max-height: 230px;
  }

  .podium .pos {
    font-size: 2.1rem;
  }

  .standings-list {
    grid-template-rows: repeat(var(--rows, 11), minmax(20px, 1fr));
  }

  .standings-row {
    font-size: 0.8rem;
  }
}

/* ---------- Tablet ---------- */

@media (max-width: 1180px) and (min-width: 900px) {
  .next-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }

  .standings-secondary {
    display: none;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 899px) {
  .app-shell {
    display: block;
  }

  .nav-drawer,
  body.nav-collapsed .nav-drawer {
    position: sticky;
    top: 0;
    z-index: 30;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--rail) 92%, transparent);
    backdrop-filter: blur(12px);
  }

  .brand-copy,
  body.nav-collapsed .brand-copy,
  .nav-toggle {
    display: none;
  }

  .drawer-brand,
  body.nav-collapsed .drawer-brand {
    display: flex;
    flex-direction: row;
  }

  .nav-mark {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }

  .view-nav {
    flex: 1;
    flex-direction: row;
  }

  body.nav-collapsed .nav-label {
    display: inline;
  }

  .view-nav button,
  body.nav-collapsed .view-nav button {
    width: auto;
    padding: 7px 10px;
    font-size: 0.85rem;
  }

  .view-nav button.is-active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: -10px;
    width: auto;
    height: 2px;
    border-radius: 2px;
  }

  .drawer-foot {
    display: none;
  }

  main {
    padding: 10px;
  }

  .bento {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .tile-weekend,
  .tile-podium,
  .tile-drivers,
  .tile-teams {
    grid-column: auto;
    grid-row: auto;
  }

  .tile {
    padding: 16px;
  }

  .next-layout {
    grid-template-columns: 1fr;
  }

  .next-track-wrap {
    order: -1;
    min-height: 0;
    margin: 4px 0 8px;
  }

  .next-track-wrap svg {
    max-height: 200px;
  }

  .countdown {
    gap: 14px;
  }

  .podium li {
    padding: 10px 0 10px 12px;
  }

  .standings {
    grid-auto-flow: row;
    grid-template-rows: none;
    overflow: visible;
  }

  .standings-col + .standings-col .standings-head {
    display: none;
  }

  .standings-list {
    max-height: none;
    grid-template-rows: none;
    grid-auto-rows: 34px;
  }

  .compare-add button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .nav-toggle svg {
    transition: none;
  }

  .track-light {
    animation: none;
    stroke-dashoffset: 0;
  }

  .skeleton,
  .sheen-text,
  .freshness.checking::before {
    animation: none;
  }

  .sheen-text {
    color: var(--muted);
    background: none;
  }
}
