body {
  min-height: 100vh;
  margin: 0;
  padding: 24px;

  background: transparent;
}

.leaderboard {
  width: 890px;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

.driver-row.has-position-gap {
  border-top: 2px solid rgba(255, 255, 255, 0.16);
}

.class-block {
  --class-color: var(--blue);

  position: relative;
  overflow: hidden;

  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.class-top-accent {
  width: 100%;
  height: 3px;

  background: var(--class-color);
}

.class-header {
  min-height: 42px;
  padding: 0 14px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.class-title {
  display: flex;
  align-items: center;
  gap: 10px;

  font-size: 23px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.class-accent {
  width: 5px;
  height: 27px;

  background: var(--class-color);
  border-radius: 999px;
}

.player-class-label {
  padding: 4px 7px;

  color: var(--class-color);
  background: color-mix(
    in srgb,
    var(--class-color) 14%,
    transparent
  );
  border: 1px solid
    color-mix(in srgb, var(--class-color) 35%, transparent);
  border-radius: 5px;

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.class-sof {
  padding: 2px 6px;

  display: flex;
  align-items: center;
  gap: 7px;

  color: #fdfcfc;

  background: color-mix(
    in srgb,
    var(--class-color) 22%,
    transparent
  );

  border: 1px solid var(--class-color);
  border-radius: 8px;

  font-size: 13px;
  font-weight: 700;
}

.class-sof strong {
  color: var(--text-primary);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.table-header,
.driver-row {
  display: grid;

  grid-template-columns:
  30px
  24px
  32px
  48px
  28px
  230px
  58px
  82px
  88px
  88px
  58px
  72px;

  align-items: center;
  column-gap: 5px;
  padding: 0 14px;
}

.table-header {
  min-height: 22px;

  color: #9da7b6;
  background: rgba(255, 255, 255, 0.04);

  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.table-header > span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.table-header > span:nth-child(9),
.table-header > span:nth-child(10) {
  transform: translateX(7px);
}

.table-header > span:nth-child(4) {
  transform: translateX(3px);
}

.table-header > span:nth-child(11) {
  transform: translateX(12px);
}

.position,
.gain-value,
.car-number,
.country-flag,
.manufacturer-logo {
  justify-self: center;
}

.last-lap {
  color: var(--text-secondary);
}

.driver-status {
  justify-self: center;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;

  text-align: center;

  transform: translateX(-12px);
}

.driver-status.status-pit {
  justify-self: center;

  width: auto;
  height: 20px;
  padding: 0 6px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: #111;
  background: #ffd400;

  border-radius: 4px;

  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

/*
 * PIT driver state
 *
 * Fahrer in der Box bleiben vollstÃ¤ndig im Leaderboard sichtbar,
 * werden aber als inaktiver Verkehr optisch gedÃ¤mpft. Die PIT-
 * Kennzeichnung bleibt klar lesbar.
 */
.driver-row.is-pit {
  background: rgba(110, 116, 124, 0.10);
  color: var(--text-muted);
}

.driver-row.is-pit:hover {
  background: rgba(110, 116, 124, 0.14);
}

.driver-row.is-pit .position,
.driver-row.is-pit .gain-value,
.driver-row.is-pit .driver-name,
.driver-row.is-pit .best-lap,
.driver-row.is-pit .last-lap,
.driver-row.is-pit .gap {
  color: var(--text-muted);
}

.driver-row.is-pit .car-number-badge {
  border-color: rgba(160, 166, 174, 0.38);
  background: rgba(160, 166, 174, 0.08);
  color: var(--text-muted);
}

.driver-row.is-pit .country-flag,
.driver-row.is-pit .manufacturer-logo,
.driver-row.is-pit .safety-rating-cell,
.driver-row.is-pit .irating-cell {
  filter: grayscale(1);
  opacity: 0.48;
}

.driver-row.is-pit .irating-cell {
  color: var(--text-muted);
  background: rgba(160, 166, 174, 0.10);
  border-color: rgba(160, 166, 174, 0.20);
}

.driver-row.is-pit .irating-current,
.driver-row.is-pit .irating-change,
.driver-row.is-pit .irating-change.positive,
.driver-row.is-pit .irating-change.negative,
.driver-row.is-pit .irating-change.neutral {
  color: var(--text-muted);
}

.driver-row.is-player.is-pit {
  background: rgba(110, 116, 124, 0.12);
}

.best-lap.is-empty,
.last-lap.is-empty {
  color: #32363b;
}

/* Flaggen */

.country-flag {
  width: 28px;
  height: 18px;

  transform: translateX(3px);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 2px;
}

.country-flag-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.flag-fallback {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.driver-row {
  position: relative;
  min-height: 32px;

  color: var(--text-primary);
  border-top: 1px solid var(--border);

  font-size: 16px;

  will-change: transform;

  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.driver-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

.driver-row:hover {
  background: rgba(255, 255, 255, 0.055);
}

.driver-row.is-player {
  background: linear-gradient(
    90deg,
    rgba(35, 125, 195, 0.48),
    rgba(35, 125, 195, 0.24)
  );

  font-weight: 550;
}

.driver-row.is-player .driver-name {
  color: #55dfff;
  font-weight: 700;
}

/* PositionsÃ¤nderungen â€“ vollstÃ¤ndige Fahrerzeile */
.driver-row.position-gain-highlight,
.driver-row.position-gain-highlight:hover {
  background: rgba(40, 190, 90, 0.35) !important;
}

.driver-row.position-loss-highlight,
.driver-row.position-loss-highlight:hover {
  background: rgba(220, 50, 50, 0.35) !important;
}

/* Absolute Rennbestzeit â€“ Vorrang vor Positions-Highlights */
.driver-row.fastest-lap-row-highlight,
.driver-row.fastest-lap-row-highlight:hover,
.driver-row.position-gain-highlight.fastest-lap-row-highlight,
.driver-row.position-loss-highlight.fastest-lap-row-highlight {
  background: rgba(155, 65, 220, 0.55) !important;
}

.position {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 550;

  transform: translateX(-7px);
}

.gain-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;

  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;

  transform: translateX(-12px);
}

.player-marker {
  color: var(--blue);
  font-size: 10px;
}

.car-number {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.car-number-badge {
  min-width: 42px;
  height: 24px;
  padding: 0 7px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 2px solid var(--driver-class-color);
  border-radius: 6px;

  background:
    color-mix(
      in srgb,
      var(--driver-class-color) 18%,
      transparent
    );

  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.manufacturer-logo {
  width: 54px;
  height: 28px;
  position: relative;
  transform: translateX(-4px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.manufacturer-logo-image {
  position: absolute;
  inset: 0;
  margin: auto;

  display: block;

  width: 100%;
  height: 100%;
  max-width: 50px;
  max-height: 26px;

  object-fit: contain;
}

.manufacturer-fallback {
  color: var(--text-secondary);

  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.manufacturer-fallback[hidden] {
  display: none;
}

.driver-name {
  padding-left: 6px;
  box-sizing: border-box;
  font-size: 18px;
  overflow: hidden;

  white-space: nowrap;
  text-overflow: ellipsis;

  font-weight: 550;
}

.numeric,
.align-right {
  text-align: right;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--green);
  font-weight: 700;
}

.negative {
  color: var(--red);
  font-weight: 700;
}

.neutral {
  color: var(--text-secondary);
}

.best-lap {
  color: var(--text-primary);
}

.best-lap.is-class-best {
  color: var(--purple);
}

.last-lap.is-personal-best {
  color: var(--green);
}

.gain-arrow {
  margin-right: 3px;
  font-size: 10px;
}

.development-message {
  padding: 20px;

  color: var(--text-primary);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.driver-count {
  padding: 4px 7px;

  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 5px;

  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.player-position-summary {
  padding: 4px 7px;

  color: var(--text-primary);
  background: rgba(70, 166, 255, 0.12);
  border: 1px solid rgba(70, 166, 255, 0.35);
  border-radius: 5px;

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.irating-cell {
  width: 68px;
  box-sizing: border-box;
  height: 22px;
  padding: 0 5px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;

  justify-self: start;
  white-space: nowrap;
  margin-left: 4px;

  color: #10151b;
  background: #aeb8c2;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;

  font-variant-numeric: tabular-nums;
}

.irating-current {
  color: #10151b;
  font-size: 15px;
  font-weight: 600;
}

.irating-change {
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0;
}

.irating-change.positive {
  color: #087a35;
}

.irating-change.negative {
  color: #c83f3f;
}

.irating-change.neutral {
  color: #303840;
}

.safety-rating-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  font-variant-numeric: tabular-nums;
}

.license-badge {
  min-width: 25px;
  height: 22px;
  padding: 0 6px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;

  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.license-rating-badge {
  width: 54px;
  box-sizing: border-box;
  padding: 0 5px;
  gap: 2px;
  justify-content: center;
}

.license-class {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.safety-rating-value {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.license-rookie {
  color: #ffffff;
  background: #e53935;
}

.license-d {
  color: #10151b;
  background: #f57c00;
}

.license-c {
  color: #10151b;
  background: #f5d000;
}

.license-b {
  color: #10151b;
  background: #39d32f;
}

.license-a {
  color: #ffffff;
  background: #075fc9;
}

.license-pro {
  color: #ffffff;
  background: #121212;
  border-color: rgba(255, 255, 255, 0.38);
}

/*
====================================================
Best Lap Highlight
====================================================
*/

.driver-row.best-lap-highlight {
  animation: bestLapFlash 1.8s ease;
}

.driver-row.best-lap-highlight .best-lap {
  color: #d96cff;
  font-weight: 700;
  text-shadow:
    0 0 6px rgba(217, 108, 255, 0.75),
    0 0 14px rgba(217, 108, 255, 0.35);

  animation: bestLapPulse 600ms ease-out;
}

@keyframes bestLapFlash {
  0% {
    background: rgba(217, 108, 255, 0.28);
  }

  35% {
    background: rgba(217, 108, 255, 0.18);
  }

  100% {
    background: transparent;
  }
}

@keyframes bestLapPulse {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

/* ============================================================
 * Compact leaderboard typography
 * ============================================================ */

.best-lap,
.last-lap {
  font-size: 18px;
  font-weight: 550;
}

/*
 * ============================================================
 * Driver Flags
 * Black Flag / Meatball / Slow Down
 * ============================================================
 */

.leaderboard-driver-flag {
  position: relative;

  display: inline-block;

  width: 30px;
  height: 22px;

  flex: 0 0 auto;

  box-sizing: border-box;

  clip-path: polygon(
    0% 8%,
    28% 2%,
    55% 8%,
    78% 3%,
    100% 8%,
    100% 92%,
    76% 97%,
    52% 91%,
    27% 97%,
    0% 91%
  );

  filter:
    drop-shadow(
      0 1px 1px
      rgba(0, 0, 0, 0.75)
    );
}


/*
 * Black Flag
 */

.leaderboard-driver-flag.flag-black {
  position: relative;
  background: #aeb8c4;

  border: none;
  outline: none;

  filter:
    drop-shadow(0 0 3px rgba(255, 255, 255, 0.45));
}

.leaderboard-driver-flag.flag-black::before {
  content: "";
  position: absolute;
  inset: 2px;

  background:
    linear-gradient(
      105deg,
      #080808 0%,
      #151515 45%,
      #303030 52%,
      #090909 100%
    );

  clip-path: polygon(
    0% 8%,
    28% 2%,
    55% 8%,
    78% 3%,
    100% 8%,
    100% 92%,
    76% 97%,
    52% 91%,
    27% 97%,
    0% 91%
  );
}


/*
 * Meatball Flag
 */

.leaderboard-driver-flag.flag-meatball {
  background:
    linear-gradient(
      110deg,
      #050505 0%,
      #181818 35%,
      #050505 65%,
      #151515 100%
    );
}

.leaderboard-driver-flag.flag-meatball::after {
  content: "";

  position: absolute;

  left: 50%;
  top: 50%;

  width: 11px;
  height: 11px;

  transform:
    translate(-50%, -50%);

  border-radius: 50%;

  background:
    radial-gradient(
      circle at 35% 30%,
      #ffad33 0%,
      #ff8500 42%,
      #e66300 100%
    );

  box-shadow:
    0 0 3px
    rgba(255, 133, 0, 0.65);
}


/*
 * Slow Down
 */

.leaderboard-driver-flag.flag-slow-down {
  background:
    linear-gradient(
      145deg,
      #080808 0%,
      #080808 49%,
      #ffffff 50%,
      #ffffff 100%
    );

  /*
   * Ruhige Flaggenform:
   * nur leicht gewellt, keine Spitze unten.
   */
  clip-path: polygon(
    0% 5%,
    48% 2%,
    100% 7%,
    100% 93%,
    52% 98%,
    0% 94%
  );

  border: 0;

  filter:
    drop-shadow(
      0 1px 1px
      rgba(0, 0, 0, 0.8)
    )
    drop-shadow(
      0 0 1px
      rgba(255, 255, 255, 0.45)
    );
}


/*
 * Dezenter Stoff-/Glanz-Effekt
 */

.leaderboard-driver-flag::before {
  content: "";

  position: absolute;
  inset: 0;

  background:
    linear-gradient(
      100deg,
      transparent 0%,
      rgba(255, 255, 255, 0.10) 28%,
      transparent 45%,
      rgba(255, 255, 255, 0.08) 68%,
      transparent 100%
    );

  pointer-events: none;
}

/*
 * Slow Down:
 * keinen zusÃ¤tzlichen Stoff-/Glanz-Layer verwenden
 */
.leaderboard-driver-flag.flag-slow-down::before {
  display: none;
}
/* ORECA: breites Schriftlogo separat skalieren */


/* Lexus: Emblem separat skalieren */

/* Audi: vier Ringe an Mercedes-Referenz anpassen */

/* Porsche: Wappen etwas grÃ¶ÃŸer darstellen */

/* Aston Martin: Fluegellogo breiter darstellen */

/* Acura: Logohoehe an Fahrerzeile anpassen */

/* Cadillac: Wappenhoehe an Fahrerzeile anpassen */


/* CAR-Spalte inklusive Header 1px nach rechts */
.table-header > :nth-child(5),
.driver-row > :nth-child(5) {
  position: relative;
  left: 1px;
}
/* MCH Standalone: PIT-Zeile vollstaendig ausgrauen */
/* Alle Inhalte gedaempft, das PIT-Badge bleibt gut sichtbar. */
.driver-row.is-pit > :not(.driver-status) {
  opacity: 0.48;
  filter: grayscale(1);
}

.driver-row.is-pit .driver-status.status-pit {
  opacity: 1;
  filter: none;
}

/* MCH SR Badge Optical Centering */
.license-rating-badge .license-class,
.license-rating-badge .safety-rating-value {
  position: relative;
  top: 1px;
}