* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --navy: #061b44;
  --navy-2: #0a2a5d;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, .68);
  --line: rgba(255, 255, 255, .16);
  --cyan: #24d2ff;
  --yellow: #ffe45c;
  --red: #ff3158;
  --gold: #f4c542;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 5%, rgba(36, 210, 255, .15), transparent 30%),
    radial-gradient(circle at 78% 12%, rgba(244, 197, 66, .10), transparent 26%),
    linear-gradient(145deg, #020817 0%, var(--navy) 56%, #020817 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.elite-track-shell {
  width: min(100vw - 28px, 1920px);
  height: calc(100vh - 28px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 24vw, 440px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.elite-track-header,
.elite-track-stage,
.elite-track-ranking {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 18, 42, .78);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .3);
  backdrop-filter: blur(10px);
}

.elite-track-header {
  grid-column: 1 / -1;
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
}

.elite-track-back {
  border: 1px solid rgba(36, 210, 255, .5);
  border-radius: 999px;
  padding: 11px 18px;
  color: var(--cyan);
  text-decoration: none;
  font-weight: 900;
  text-transform: uppercase;
}

.elite-track-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.elite-track-brand img {
  width: 190px;
  max-height: 54px;
  object-fit: contain;
}

.elite-track-brand span,
.elite-track-clock span,
.elite-track-meta span,
.elite-track-ranking-head span {
  display: block;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.elite-track-brand strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(24px, 3vw, 44px);
  line-height: 1.02;
  text-transform: uppercase;
}

.elite-track-clock {
  min-width: 220px;
  border: 1px solid rgba(255, 228, 92, .45);
  border-radius: 8px;
  padding: 12px 18px;
  text-align: right;
  background: rgba(255, 255, 255, .06);
}

.elite-track-clock strong {
  color: var(--yellow);
  font-size: clamp(26px, 3vw, 46px);
  line-height: 1;
}

.elite-track-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.elite-track-meta {
  display: grid;
  grid-template-columns: minmax(180px, .75fr) minmax(260px, 1.25fr) minmax(142px, 170px) minmax(170px, 210px);
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.elite-track-meta div {
  min-width: 0;
  border: 1px solid rgba(36, 210, 255, .24);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, .16);
}

.elite-track-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  text-transform: uppercase;
}

.elite-track-race-card strong {
  font-size: clamp(15px, 1.45vw, 20px);
}

.elite-track-weather-card,
.elite-track-status-card {
  position: relative;
  min-height: 66px;
}

.elite-track-weather-card[hidden] {
  display: none !important;
}

.elite-track-weather-card {
  display: grid;
  grid-template-areas:
    "label temp"
    "main main";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  row-gap: 3px;
  border-color: rgba(36, 210, 255, .48) !important;
  background: linear-gradient(145deg, rgba(0, 105, 160, .4), rgba(0, 0, 0, .22)) !important;
}

.elite-track-weather-card > span:first-child {
  grid-area: label;
  font-size: 10px;
}

.elite-track-weather-card strong {
  grid-area: main;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 15px;
  line-height: 1.03;
}

.elite-track-weather-card strong > span {
  color: inherit;
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.elite-track-weather-card strong > span:last-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.elite-track-weather-card small {
  grid-area: temp;
  color: var(--yellow);
  font-size: 25px;
  font-weight: 1000;
  line-height: .95;
}

.track-weather-label-main,
.track-weather-label-prob {
  display: inline;
}

.track-weather-label-prob {
  margin-left: 4px;
  color: var(--yellow);
}

.track-weather-symbol {
  position: relative;
  display: inline-block !important;
  width: 32px;
  height: 22px;
}

.track-weather-symbol::before,
.track-weather-symbol::after {
  content: "";
  position: absolute;
  display: block;
}

.track-weather-symbol-clear::before {
  inset: 2px 5px;
  border-radius: 999px;
  background: #ffe45c;
  box-shadow: 0 0 12px rgba(255, 228, 92, .7);
}

.track-weather-symbol-clouds::before,
.track-weather-symbol-rain::before,
.track-weather-symbol-snow::before,
.track-weather-symbol-storm::before,
.track-weather-symbol-weather::before {
  left: 2px;
  right: 8px;
  bottom: 4px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 8px -6px 0 -1px #fff, 17px -2px 0 -2px #fff;
}

.track-weather-symbol-rain::after {
  left: 7px;
  bottom: -2px;
  width: 2px;
  height: 7px;
  border-radius: 99px;
  background: #31d7ff;
  box-shadow: 7px 2px 0 #31d7ff, 14px 0 0 #31d7ff;
  transform: rotate(14deg);
}

.track-weather-symbol-snow::after {
  left: 5px;
  bottom: -4px;
  color: #fff;
  content: "* *";
  font-size: 13px;
  font-weight: 1000;
  line-height: 1;
}

.track-weather-symbol-storm::after {
  left: 10px;
  bottom: -4px;
  width: 8px;
  height: 13px;
  background: #ffe45c;
  clip-path: polygon(42% 0, 100% 0, 60% 45%, 92% 45%, 18% 100%, 44% 55%, 14% 55%);
}

.track-weather-symbol-fog::before,
.track-weather-symbol-fog::after {
  left: 2px;
  width: 24px;
  height: 2px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 7px 0 rgba(255,255,255,.72);
}

.track-weather-symbol-fog::before {
  top: 4px;
}

.track-weather-symbol-fog::after {
  top: 16px;
  width: 19px;
}

.elite-track-status-card {
  overflow: hidden;
}

.elite-track-status-card strong {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: clamp(15px, 1.4vw, 20px);
}

.elite-track-status-card strong > span {
  color: inherit;
  font-size: inherit;
  letter-spacing: 0;
  text-transform: uppercase;
}

.elite-track-status-card.track-race-status-yellow {
  animation: trackStatusYellowPulse 900ms ease-in-out infinite;
}

.elite-track-status-card.track-race-status-red {
  animation: trackStatusRedPulse 900ms ease-in-out infinite;
}

.elite-track-status-card.track-race-status-checkered {
  animation: trackStatusCheckeredPulse 1200ms ease-in-out infinite;
}

.elite-track-status-card.track-race-status-warmup {
  animation: trackStatusWarmupPulse 1000ms ease-in-out infinite;
}

.track-race-status-icon {
  position: relative;
  display: inline-block !important;
  flex: 0 0 auto;
  width: 34px;
  height: 24px;
}

.track-race-status-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 3px;
  height: 28px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 5px rgba(255,255,255,.8);
}

.track-race-status-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 25px;
  height: 17px;
  border-radius: 4px;
  border: 2px solid rgba(255,255,255,.82);
  background: #8794a5;
  box-shadow: 0 0 10px rgba(0,0,0,.35);
}

.track-race-status-icon-green::after { background: #00b958; }
.track-race-status-icon-yellow::after { background: #ffd400; }
.track-race-status-icon-red::after { background: #e00018; }
.track-race-status-icon-warmup::after { background: #6b1fb1; }

.track-race-status-icon-checkered::after {
  background:
    linear-gradient(45deg, #fff 25%, transparent 25%),
    linear-gradient(-45deg, #fff 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #fff 75%),
    linear-gradient(-45deg, transparent 75%, #fff 75%),
    #05070b;
  background-size: 10px 10px;
}

.track-race-status-icon-stop {
  width: 34px;
  height: 34px;
}

.track-race-status-icon-stop::before {
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  border-radius: 0;
  background: #fff;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
}

.track-race-status-icon-stop::after {
  content: "STOP";
  left: 3px;
  top: 3px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: none;
  border-radius: 0;
  background: #e00018;
  color: #fff;
  font-size: 7px;
  font-weight: 1000;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
}

@keyframes trackStatusYellowPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255, 212, 0, .34), 0 0 0 rgba(255, 212, 0, 0); }
  50% { box-shadow: inset 0 0 0 1px rgba(255, 212, 0, .75), 0 0 22px rgba(255, 212, 0, .32); }
}

@keyframes trackStatusRedPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255, 65, 88, .4), 0 0 0 rgba(255, 65, 88, 0); }
  50% { box-shadow: inset 0 0 0 1px rgba(255, 65, 88, .86), 0 0 26px rgba(255, 65, 88, .36); }
}

@keyframes trackStatusCheckeredPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

@keyframes trackStatusWarmupPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(170, 96, 255, .3); }
  50% { box-shadow: inset 0 0 0 1px rgba(170, 96, 255, .86), 0 0 22px rgba(170, 96, 255, .3); }
}

.elite-track-map-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.elite-track-map {
  width: 100%;
  height: 100%;
  display: block;
}

.track-outline-shadow {
  fill: none;
  stroke: rgba(0, 0, 0, .55);
  stroke-width: 40;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-outline {
  fill: none;
  stroke: rgba(255, 255, 255, .92);
  stroke-width: 18;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#trackGlow);
}

body.track-flag-red .track-outline {
  stroke: #ff244f;
  filter: drop-shadow(0 0 18px rgba(255, 36, 79, .9));
}

body.track-flag-green .track-outline {
  stroke: #26ff6a;
  filter: drop-shadow(0 0 18px rgba(38, 255, 106, .85));
}

.track-centerline {
  display: none;
}

.pit-lane-shadow {
  fill: none;
  stroke: rgba(0, 0, 0, .3);
  stroke-width: 24;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pit-lane-line {
  fill: none;
  stroke: rgba(106, 114, 124, .34);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-xml-label {
  fill: #ff41ff;
  font-size: 18px;
  font-weight: 1000;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: #061b44;
  stroke-width: 4px;
}

.track-xml-label.small {
  font-size: 15px;
  stroke-width: 3.5px;
}

.loop-marker line {
  stroke: var(--yellow);
  stroke-width: 5;
  stroke-linecap: round;
}

.loop-marker text {
  fill: var(--yellow);
  font-size: 18px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #061b44;
  stroke-width: 5;
}

.car-point {
  filter: url(#trackPointShadow);
  will-change: transform;
}

.car-point circle {
  stroke-width: 4;
}

.car-point.leader circle {
  fill: var(--red);
  stroke: #fff;
}

.car-point:not(.leader) circle {
  fill: #fff;
  stroke: var(--cyan);
}

.car-point text {
  fill: #061b44;
  font-size: 18px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
}

.car-point.leader text {
  fill: #fff;
  stroke: rgba(0, 0, 0, .35);
  stroke-width: 2;
  paint-order: stroke;
}

.car-point.pit-stop circle {
  fill: var(--yellow);
  stroke: #101010;
  animation: pitPointPulse .75s infinite;
}

.car-point.pit-stop text {
  fill: #101010;
}

.elite-track-empty {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(680px, 80%);
  border: 1px solid rgba(36, 210, 255, .35);
  border-radius: 8px;
  padding: 24px;
  background: rgba(5, 18, 42, .92);
  color: var(--muted);
  font-size: 24px;
  font-weight: 900;
  text-align: center;
}

.elite-track-empty[hidden] {
  display: none;
}

.elite-track-ranking {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.elite-track-ranking-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.elite-track-ranking-head > div {
  min-width: 0;
}

.elite-track-ranking-head small {
  display: block;
  margin-top: 4px;
  color: rgba(214, 226, 241, 0.62);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.elite-track-ranking-head strong {
  color: var(--yellow);
  font-size: 28px;
}

.elite-track-ranking-rows {
  overflow: auto;
  padding: 10px;
}

.elite-track-row {
  display: grid;
  grid-template-columns: 34px 48px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 58px;
  margin-bottom: 7px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, .06);
}

.elite-track-row:first-child {
  background: rgba(244, 197, 66, .34);
}

.elite-track-row.pit-stop {
  border-color: rgba(255, 228, 92, .86);
  background: rgba(255, 228, 92, .16);
  box-shadow: inset 0 0 0 1px rgba(255, 228, 92, .28), 0 0 18px rgba(255, 228, 92, .18);
}

.elite-track-row b {
  color: var(--yellow);
}

.elite-track-pos {
  text-align: center;
}

.elite-track-num {
  min-width: 0;
  text-align: center;
}

.elite-track-competitor {
  min-width: 0;
}

.elite-track-row strong,
.elite-track-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.elite-track-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.elite-track-rank-detail {
  display: block;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  color: var(--yellow) !important;
  font-size: clamp(10px, .7vw, 12px) !important;
  line-height: 1.08;
  letter-spacing: .02em;
}

.elite-track-gaps {
  grid-column: 3 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  margin-top: -2px;
}

.elite-track-gaps span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(0, 0, 0, .22);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.elite-track-gaps em {
  color: var(--cyan);
  font-style: normal;
  font-size: 9px;
  text-transform: uppercase;
}

.pit-stop-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--yellow);
  color: #101010 !important;
  font-size: 11px !important;
  font-weight: 1000;
  letter-spacing: .04em;
  animation: pitBadgePulse .75s infinite;
}

@keyframes pitBadgePulse {
  0%, 100% {
    filter: brightness(1);
    transform: translateZ(0);
  }
  50% {
    filter: brightness(1.55);
  }
}

@keyframes pitPointPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .42;
  }
}

.elite-track-footer {
  position: fixed;
  right: 16px;
  bottom: 8px;
  color: rgba(255, 255, 255, .54);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .elite-track-shell {
    height: auto;
    min-height: calc(100vh - 18px);
    width: calc(100vw - 12px);
    margin: 6px auto 18px;
    grid-template-columns: 1fr;
  }

  .elite-track-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .elite-track-brand img {
    width: 140px;
  }

  .elite-track-clock {
    min-width: 0;
    text-align: left;
  }

  .elite-track-meta {
    grid-template-columns: 1fr;
  }

  .elite-track-map-wrap {
    height: 64vh;
  }
}
