:root {
  --text: #f7fafb;
  --panel: rgba(12, 14, 16, 0.82);
  --accent: #00d084;
}

* {
  box-sizing: border-box;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: #111;
}

#map {
  position: relative;
  overflow: hidden;
}

.tracking-overlay-host {
  position: relative !important;
}

#status {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: 360px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  background: var(--panel);
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  z-index: 10;
}

.help-map-button {
  position: absolute;
  right: 12px;
  bottom: 66px;
  z-index: 10;
  padding: 7px 10px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  color: #fff;
  background: rgba(7, 29, 73, 0.88);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.32);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.help-map-button:hover,
.help-map-button:focus-visible {
  color: #07111c;
  background: #f2d34b;
  outline: none;
}

.leaderboard {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
}

.leaderboard-headline {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}

.leaderboard-top {
  min-width: 210px;
  padding: 7px 16px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(7, 29, 73, 0.82);
}

.leaderboard-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  text-align: center;
  font-size: 21px;
  font-weight: 800;
}

.sponsor-slot {
  display: grid;
  flex: 0 0 auto;
  width: 210px;
  height: 42px;
  padding: 4px 6px;
  place-items: center;
  overflow: hidden;
  background: transparent;
}

.sponsor-slot[hidden] {
  display: none;
}

.sponsor-slot img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

.race-flag {
  flex: 0 0 auto;
  width: 24px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.flag-checkered .race-flag {
  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%),
    #050505;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.flag-yellow .race-flag {
  background: #ffd400;
}

.flag-red .race-flag {
  background: #e00018;
}

.flag-green .race-flag {
  background: #00a650;
}

.leaderboard-panel {
  position: absolute;
  top: 58px;
  left: 14px;
  width: 285px;
  max-height: calc(100vh - 76px);
  overflow-y: auto;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-right: 4px;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.35));
}

.leaderboard-panel::-webkit-scrollbar {
  width: 5px;
}

.leaderboard-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.powered-by {
  width: 142px;
  margin: 0 0 6px 2px;
}

.organizer-slot {
  display: grid;
  width: 100%;
  height: 74px;
  padding: 6px 8px;
  margin: 0 0 6px;
  place-items: center;
  overflow: hidden;
  background: transparent;
}

.organizer-slot[hidden] {
  display: none;
}

.organizer-slot img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

.powered-by span {
  display: block;
  margin: 0 0 2px 2px;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.powered-by img {
  display: block;
  width: 142px;
  height: auto;
  filter:
    brightness(0)
    invert(1)
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.85));
}

.leaderboard-panel header {
  margin-bottom: 6px;
  padding: 8px 11px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(7, 29, 73, 0.9);
  color: #fff;
  cursor: pointer;
}

.leaderboard-panel header span,
.leaderboard-panel header strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.leaderboard-panel header span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 10px;
  font-weight: 700;
}

.leaderboard-panel header strong {
  margin-top: 3px;
  font-size: 14px;
}

.speed-alert {
  position: relative;
  margin: 0 0 7px;
  padding: 8px 9px 9px;
  border: 2px solid #000;
  border-radius: 8px;
  background: rgba(224, 0, 24, 0.92);
  color: #fff;
  pointer-events: auto;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.speed-alert[hidden] {
  display: none;
}

.speed-alert strong {
  display: block;
  padding-right: 26px;
  font-size: 12px;
  text-transform: uppercase;
}

.speed-alert span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-alert-close {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
}

.speed-alert-action {
  width: auto;
  height: 24px;
  margin-top: 7px;
  padding: 0 10px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: #071d49;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  min-height: 29px;
  overflow: visible;
  margin-bottom: 4px;
  background: transparent;
  color: #fff;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    0 2px 4px rgba(0, 0, 0, 0.65);
  transition: background 650ms ease, transform 650ms ease;
}

.leaderboard-bubble {
  display: grid;
  grid-template-columns: 30px 52px 62px;
  align-items: center;
  width: 144px;
  height: 29px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(7, 29, 73, 0.72);
  cursor: pointer;
}

.leaderboard-bubble:hover {
  background: rgba(12, 47, 113, 0.86);
}

.leaderboard-bubble .pos {
  display: grid;
  height: 100%;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: #071d49;
  font-size: 13px;
  font-weight: 900;
  text-shadow: none;
}

.leaderboard-bubble .num,
.leaderboard-bubble .name {
  font-weight: 900;
}

.leaderboard-bubble .num {
  padding-left: 6px;
  padding-right: 7px;
  color: #ffea00;
  font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
  font-size: 17px;
  font-weight: 700;
  font-stretch: condensed;
}

.leaderboard-bubble .name {
  overflow: hidden;
  max-width: none;
  padding-right: 8px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row .gap {
  flex: 0 0 auto;
  margin-left: 5px;
  min-width: 50px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.46);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-align: right;
}

.leaderboard-row .gap:empty {
  display: none;
}

.leaderboard-pit-flag {
  flex: 0 0 auto;
  margin-left: 5px;
  padding: 3px 6px;
  border: 2px solid #000;
  border-radius: 4px;
  color: #000;
  background: #ffd900;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.24);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-shadow: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.rotate-warning {
  display: none;
}

.rotate-warning-content {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.rotate-warning-content p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
}

.rotate-warning-content .flag {
  font-size: 28px;
  line-height: 1;
}

@media (orientation: portrait) and (max-width: 820px) {
  .rotate-warning {
    position: absolute;
    inset: 0;
    z-index: 999;
    display: grid;
    place-items: center;
    padding: 32px;
    background: #071d49;
    color: #fff;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
  }
}

@media (orientation: landscape) and (max-width: 920px) {
  .help-map-button {
    right: 8px;
    bottom: 56px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .leaderboard-headline {
    top: 8px;
    gap: 5px;
    max-width: calc(100vw - 12px);
  }

  .leaderboard-top {
    min-width: 160px;
    padding: 5px 12px;
  }

  .leaderboard-top {
    gap: 7px;
    font-size: 17px;
  }

  .sponsor-slot {
    width: 160px;
    height: 34px;
  }

  .race-flag {
    width: 20px;
    height: 13px;
  }

  .leaderboard-panel {
    top: 48px;
    left: 8px;
    width: 270px;
    max-height: calc(100vh - 56px);
  }

  .powered-by {
    width: 118px;
    margin-bottom: 4px;
  }

  .organizer-slot {
    height: 74px;
    margin-bottom: 4px;
  }

  .powered-by img {
    width: 118px;
  }

  .leaderboard-panel header {
    padding: 6px 9px;
  }

  .leaderboard-panel header span {
    font-size: 9px;
  }

  .leaderboard-panel header strong {
    font-size: 12px;
  }

  .leaderboard-row {
    min-height: 26px;
    margin-bottom: 3px;
  }

  .leaderboard-bubble {
    grid-template-columns: 26px 46px 54px;
    width: 126px;
    height: 26px;
  }

  .leaderboard-bubble .pos {
    font-size: 12px;
  }

  .leaderboard-bubble .num {
    font-size: 15px;
  }

  .leaderboard-bubble .name {
    max-width: none;
    font-size: 12px;
  }

  .leaderboard-row .gap {
    margin-left: 4px;
    min-width: 36px;
    padding: 2px 5px;
    font-size: 9px;
  }

  .leaderboard-pit-flag {
    margin-left: 4px;
    padding: 2px 4px;
    font-size: 8px;
  }
}

.leaderboard-row.up {
  animation: leaderboardUp 3200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.leaderboard-row.down {
  animation: leaderboardDown 3200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes leaderboardUp {
  0% { background: rgba(48, 209, 88, 0.95); transform: translateX(-16px); }
  18% { background: rgba(48, 209, 88, 0.95); transform: translateX(0); }
  70% { background: rgba(48, 209, 88, 0.46); transform: translateX(0); }
  100% { background: rgba(7, 29, 73, 0); transform: translateX(0); }
}

@keyframes leaderboardDown {
  0% { background: rgba(255, 77, 94, 0.95); transform: translateX(16px); }
  18% { background: rgba(255, 77, 94, 0.95); transform: translateX(0); }
  70% { background: rgba(255, 77, 94, 0.46); transform: translateX(0); }
  100% { background: rgba(7, 29, 73, 0); transform: translateX(0); }
}

.info-card {
  min-width: 230px;
  max-width: min(280px, calc(100vw - 56px));
  max-height: min(420px, calc(100vh - 120px));
  overflow-y: auto;
  padding-right: 3px;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  -webkit-overflow-scrolling: touch;
}

.gm-style .gm-style-iw-c {
  padding: 8px 12px 12px !important;
}

.gm-style .gm-style-iw-chr {
  position: absolute !important;
  top: 3px !important;
  right: 6px !important;
  z-index: 2 !important;
  height: 30px !important;
}

.gm-style .gm-style-iw-ch {
  display: none !important;
}

.gm-style .gm-style-iw-d {
  overflow: auto !important;
}

.gm-style .gm-ui-hover-effect {
  top: 3px !important;
  right: 6px !important;
  width: 30px !important;
  height: 30px !important;
}

.info-card .speed-live {
  margin: 4px 0 5px;
  color: #0b7a4a;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.pit-badge {
  display: inline-block;
  margin: 2px 0 4px;
  padding: 5px 10px;
  border: 2px solid #000;
  border-radius: 4px;
  color: #000;
  background: #ffd900;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.18);
}

.info-race-badge {
  display: grid;
  grid-template-columns: 30px 52px 62px;
  align-items: center;
  width: 144px;
  height: 29px;
  margin: 0 38px 5px 0;
  overflow: hidden;
  border: 2px solid #000;
  border-radius: 8px;
  background: rgba(7, 29, 73, 0.9);
  color: #fff;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.info-race-badge .pos {
  display: grid;
  height: 100%;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: #071d49;
  font-size: 13px;
  font-weight: 900;
  text-shadow: none;
}

.info-race-badge .num {
  padding-left: 6px;
  padding-right: 7px;
  color: #ffea00;
  font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.info-race-badge .name {
  overflow: hidden;
  padding-right: 8px;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-card dl {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 13px;
}

@media (max-width: 520px) {
  .gm-style .gm-style-iw-c {
    max-width: calc(100vw - 30px) !important;
    padding: 8px 10px 10px !important;
  }

  .gm-style .gm-style-iw-d {
    max-height: calc(100vh - 105px) !important;
    overflow: auto !important;
  }

  .info-card {
    min-width: 205px;
    max-width: calc(100vw - 58px);
    max-height: calc(100vh - 125px);
  }

  .info-card .speed-live {
    margin: 3px 0 4px;
    font-size: 22px;
  }

  .info-race-badge {
    grid-template-columns: 26px 46px 54px;
    width: 126px;
    height: 26px;
    margin-right: 32px;
    margin-bottom: 4px;
  }

  .info-race-badge .pos {
    font-size: 12px;
  }

  .info-race-badge .num {
    font-size: 15px;
  }

  .info-race-badge .name {
    font-size: 12px;
  }

  .info-card dl {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 3px 7px;
    font-size: 11px;
  }

  .radio-meters {
    gap: 7px;
  }

  .radio-meters > span {
    font-size: 10px;
  }
}

.info-card dt {
  color: #555;
}

.info-card dd {
  margin: 0;
  font-weight: 600;
}

.info-card dt:nth-of-type(-n + 2),
.info-card dd:nth-of-type(-n + 2) {
  color: #111;
  font-size: 14px;
  font-weight: 800;
}

.radio-meters {
  display: flex;
  align-items: center;
  gap: 12px;
}

.radio-meters > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #555;
  font-size: 11px;
  font-weight: 700;
}

.signal-meter {
  display: inline-flex;
  align-items: flex-end;
  height: 18px;
}

.signal-meter .bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.signal-meter .bars span {
  width: 4px;
  border-radius: 2px 2px 0 0;
  background: #c7c7c7;
}

.signal-meter .bars span.on {
  background: #111;
}
