    @font-face {
        font-family: 'LeagueSpartan';
        src: url('../league-spartan.bold.ttf') format('truetype');
        font-weight: lighter;
        font-style: normal;
    }

    body {
      background-color: #000;
      background-image: url('../background-livetiming.png');
      background-size: cover;
      color: white;
      font-family: 'BlackOpsOne', monospace;
      margin: 0;
      overflow: hidden;
    }

#header {
    font-size: 1.5em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    max-height: 48px;
    overflow: hidden;
}

#header .header-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.05;
}

#header .header-title {
    font-size: 0.72em;
}

#header .header-meta {
    font-size: 0.58em;
}

#session {
  visibility: hidden;
}

#session-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  padding: 0;
}

#left-column {
  background-color: transparent;
  padding: 0.5rem;
}

#right-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem; /* Optional: adds space between rows */
  padding: 0.5rem;
  background-color: transparent;
}

.row {
  background-color: #ffffff;
  padding: 1rem;
}

.table {
  display: flex;
  flex-direction: column;
  gap: 0.1vw;
  background-color: rgba(0, 0, 0, 0.8);
  border: 2px solid #333;
  padding: 0.5vw;
}

.driver-row {
  display: grid;
  /* grid-template-columns: 60px 100px 120px 120px 140px 140px 140px 140px 140px 140px; */
  grid-template-columns: 5% 9% 10% 10% 11% 11% 11% 11% 11% 11%;
  transition: transform 2.4s ease;
  will-change: transform;
  border-radius: 6px;
}

.row-glow {
  animation: rowGlow 2.0s ease-in-out;
}

@keyframes rowGlow {
  0% {
    border-color: lime;
    box-shadow: 0 0 14px 4px lime;
  }
  100% {
    border-color: transparent;
    box-shadow: none;
  }
}

.cell {
  display: flex;
  flex-direction: column;
  background-color: #111;
  border: 1px solid #333;
  text-align: center;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  border-radius: 5px;
  min-height: calc(max(3.9vh, 2vw));
  cursor: pointer;
}

.driver-name img {
  vertical-align: middle;
}

    .soft { color: red; }
    .medium { color: yellow; }
    .hard { color: white; }

.sector-line {
  display: block;
  text-align: center;
  align-items: center;
  justify-content: center;
  width: 85%; 
  height: 3px;
  margin: 0 auto;
  padding: 0;
  border: none;
}

.sector-bar-group {
  display: flex;
  justify-content: center;
  gap: 1px;
  margin-top: 2px;
  width: 85%;
  margin-left: auto;
  margin-right: auto;
}

.segment {
    flex: 1 1 10%;      /* 10 segments will fill the width */
    max-width: 10%;     /* Limit to 1/10 even if fewer segments */
    height: 4px;
    background-color: gray;
}
    
.status-2048 { background-color: rgba(255, 255, 0, 0.8); }
.status-2049 { background-color: #05ea07; }
.status-2051 { background-color: #fd01fd; }
.status-2064 { background-color: #3b82f6; }

    /* Optional: fallback */
    .segment:not([class*="status-"]) {
    background-color: #555;
    }

    #settings-icon {
        position: fixed;
        top: 5px;
        right: 5px;
        cursor: pointer;
        font-size: 24px;
        color: white;
    }

    #settings-menu {
        display: none;
        position: fixed;
        top: 40px;
        right: 30px;
        background: #111;
        border: 1px solid #444;
        padding: 10px;
        color: white;
        z-index: 9000;
    }

    #settings-menu.hidden {
        display: none;
    }

    #settings-menu:not(.hidden) {
        display: block;
    }

    #news-window {
        /* max-height: 240px; */
        max-height: 150px;
        overflow-y: auto;
        background: rgba(0,0,0,0.85);
        color: white;
        border: 1px solid #444;
        border-radius: 8px;
        padding: 10px;
        font-size: 1.0em;
        z-index: 999;
    }

    #other-window {
      margin-top: 5px;
      height: 120px;
        /* max-height: 240px; */
        overflow-y: hidden;
        background: rgba(0,0,0,0.85);
        color: white;
        border: 1px solid #444;
        border-radius: 8px;
        padding: 10px;
        font-size: 1.0em;
        z-index: 999;
    }

    #flag-window {
    max-height: 100px;
    background: rgba(0,0,0,0.9);
    color: white;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    font-size: 1.0em;
    z-index: 999;
}

  #flag-content {
    font-size: 1.2em;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 2px;
    max-height: 2.2em;
    overflow: hidden;
}

#flag-content .flag-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.05;
}

#flag-content .flag-time {
  color: rgba(255, 255, 0, 0.7);
  font-size: 0.92em;
}

#flag-content .flag-message {
  font-size: 0.88em;
}

#drs-window {
    display: none;
    max-height: 100px;
    background: rgba(0,0,0,0.9);
    color: white;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    font-size: 1.0em;
    z-index: 999;
}

#drs-content {
    font-size: 1.2em;
}


#radio-messages {
  position: relative;
  margin-top: 5px;
  height: 120px;
  width: auto;

  /* height: 130px; */
  background: rgba(0,0,0,0.85);
  color: white;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px;
  font-size: 1.0em;
  overflow: hidden; /* or hidden / scroll */
  z-index: 999;
}

#radio-list {
  margin-top: 4px;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0px;
}

#radio-list li {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  padding: 0;
  line-height: 0.9;
  border-bottom: none;
}

#radio-list li span:last-child {
  font-size: 0.82em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#other {
  margin-top: 4px;
  overflow: hidden;
  height: 100%;
}

#weatherTable {
  border-collapse: collapse;
  border-spacing: 0;
  line-height: 1.05;
}

#weatherTable tr {
  height: 1.02em;
}

#news-content {
  margin-top: 10px;
}

#map {
  position: relative;
  /* height: 320px; */
  width: 590px;
  /* width: auto; */
  aspect-ratio: 16 / 9;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid #444;
  transition: all 0.3s ease;
  overflow: hidden;
  cursor: move;
  border-radius: 8px;
  padding: 10px;
  box-shadow:
    0 6px 10px rgba(0, 0, 0, 0.5),
    0 12px 30px rgba(0, 0, 0, 0.4),
    0 20px 40px rgba(0, 0, 0, 0.3);
}

#flag-display {
    position: relative;
    background: rgba(0,0,0,0.85);
    /* background-image: url('safety_car.png'); */
    background-image: url('../images/flags/flag_monitor_background.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* background-blend-mode: multiply; */
    /* background-blend-mode: overlay; */
    /* opacity: 0.9; */
    width: 130px;
    height: 130px;
    color: white;
    border-radius: 8px;
    padding: 10px;
    font-size: 1.0em;
    z-index: 999;
    /* filter: brightness(2.6) contrast(1.1); */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.7);
}

#flag-display img {
  position: absolute;
  margin-top: 2px;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

@keyframes blink {
  0% { opacity: 1; filter: brightness(5.6) contrast(0.9);}
  50% { opacity: 0.2; filter: brightness(2.6) contrast(0.7);}
  100% { opacity: 1; filter: brightness5(5.6) contrast(0.9);}
}


#drs-display {
    background: rgba(0,0,0,0.85);
    background-image: url('../drs.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* background-blend-mode: multiply; */
    background-blend-mode: overlay;
    opacity: 0.5;
    width: 110px;
    height: 110px;
    color: white;
    border-radius: 8px;
    padding: 10px;
    font-size: 1.0em;
    margin-top: 10px;
    z-index: 999;
    filter: brightness(2.6) contrast(1.1);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.7);
}
#drs-display.active {
    background-blend-mode: normal;
    filter: brightness(1.0) contrast(1.0);
    opacity: 1;
}

audio {
  width: 50%;
  height: 20px;
  margin-top: 0;
  background-color: #222;
  border-radius: 6px;
}

#map.maximized {
  position: fixed;
  width: 75%;
  height: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1100;
  border-radius: 10px;
}

#toggleMapButtons {
  position: absolute;
  display: inline-flex;
  gap: 0; /* no space between buttons */
  top: 5px;
  right: 5px;
  z-index: 2000;
}

#toggleMapButtons button {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #999;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
}

#raceCanvasMap {
  position: absolute;
  z-index: 1101;
}

#raceCanvas {
  position: absolute;
  z-index:1102;
}

#raceCanvas, #raceCanvasMap {
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: block;
}

.driver-dot {
  r: 10;
  stroke: rgb(126, 30, 30);
  stroke-width: 0.5;
}

.compare-panel {
  font-family: monospace;
}
.compare-header {
  font-weight: bold;
  font-size: 1.3em;
  margin-bottom: 8px;
}
.compare-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #333;
}
.compare-label {
  flex: 1.4;
  font-weight: bold;
  color: #aaa;
}
.compare-row .highlight {
  color: lime;
  font-weight: bold;
}

#comparison-backdrop.hidden,
#driver-comparison.hidden,
#driverTooltip.hidden {
  display: none !important;
}

#comparison-backdrop:not(.hidden),
#driver-comparison:not(.hidden),
#driverTooltip:not(.hidden) {
  display: block !important;
}

#comparison-backdrop, #racingField-backdrop {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(1px);
  background: rgba(0, 0, 0, 0.4);
  z-index: 1900;
  display: none;
}

#driver-comparison {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 20, 20, 0.95);
  color: white;
  padding: 25px 30px;
  border: 2px solid #555;
  border-radius: 16px;
  display: none;
  z-index: 1901;
  width: 75vw;
  max-width: 90vw;
  max-height: 80vh;
  overflow-x: hidden;
  box-shadow: 0 0 20px rgba(0,255,0,0.3);
}

.racing-car {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1em;
  color: white;
  pointer-events: none;
  transition: transform 0.6s ease;
  will-change: transform;
  transform: translate(0, 0);
}

/* .racing-car.in-pit {
  bottom: 10px !important;
  left: 50px !important;
  opacity: 0.0;
}

.racing-car.retired {
  bottom: 10px !important;
  right: auto !important;
  left: 50px;
  opacity: 0.0;
  filter: grayscale(100%);
} */

.racing-car .label {
  /* font-weight: bold; */
  color: #fff;
  font-size: 1.1em;
  font-size: var(--label-size, 1.1em); 
}

.racing-car .gap-to-leader {
  opacity: 0.8;
  color: orange;
  /* font-size: 1.0em; */
  font-size: var(--gap-size, 1.0em); 
}

.racing-car .car-img {
  /* width: 120px; */
  width: var(--car-size, 120px); 
  height: auto;
  display: block;
}

#racingField {
  /* position: fixed !important; */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 20, 20, 0.95);
  color: white;
  padding: 25px 30px;
  border: 2px solid #555;
  border-radius: 16px;
  display: none;
  z-index: 1901;
  width: 100%;
  height: 100%;
  /* width: 75vw;
  height: 75vh;
  max-width: 90vw;
  max-height: 80vh; */
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0,255,0,0.3);
}


/* .racing-field {
  position: relative;
  width: 100%;
  height: 100%;
  background: #111;
  overflow: hidden;
} */

.gap-scale {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: repeating-linear-gradient(
    to right,
    #888,
    #888 1px,
    transparent 1px,
    transparent 40px
  );
  font-size: 12px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  z-index: 10;
}

.top-lane {
  position: absolute;
  bottom: 0px;
  left: 0;
  right: 0;
  height: 10%;
  background: rgba(255, 0, 0, 0.1);
  display: flex;
  align-items: center;
  /* justify-content: flex-start; */
  justify-content: space-between;
  gap: 20px;
  padding-left: 10px;
  z-index: 5;
  border-bottom: 1px dashed #aaa;
}

.pit-right, .pit-left {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 100%;
}

.pit-right {
  justify-content: flex-end;
}

.pit-left {
  justify-content: flex-start;
}


.cars-layer {
  position: absolute;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
}

.gap-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  margin: 20px 0;
  padding: 10px;
  border: 1px dashed #555;
  background: #000;
  border-radius: 10px;
  /* gap: 12px; */
}

.gap-car {
  /* position: relative; */
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: margin 0.4s ease;
}

.gap-car .label {
  font-size: 1.2em;
  /* margin-top: 4px; */
  color: #aaa;
  /* margin-top: -50px; */
}

.gap-value {
  font-size: 1.2em;
  color: orange;
  margin-top: 4px;
  /* margin-top: -25px; */
}

.gap-car .car-img {
  /* height: 60px; */
  width: 300px;
  margin-top: -70px;
  margin-bottom: -70px;
  transition: transform 0.3s ease;
}

.gap-line {
  text-align: center;
  font-size: 1.4em;
  margin-top: -180px;
  font-weight: bold;
  white-space: nowrap;
}

.gap-me .car-img {
  transform: scale(1.15);
  filter: drop-shadow(0 0 6px rgb(138, 255, 138));
}

.fastest {
  color: #fd01fd;
  font-weight: bold;
}

/* .fastest::after {
  content: ' ⚡';
  display: inline-block;
  margin-left: 4px;
} */

.driver-compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 1.2em;
  margin-top: 4px;
  text-align: center;
}

.driver-compare-table th,
.driver-compare-table td {
  padding: 2px 3px;
  border: 1px solid #ddd;
}

.driver-compare-table thead th {
  font-weight: bold;
  background-color: #555;
}

.driver-compare-table td.highlight,
.driver-compare-table th.highlight {
  /* color: #effd22; */
  font-weight: bold;
}

/* ✅ Set first column (metric labels) to minimal width */
.driver-compare-table td:first-child,
.driver-compare-table th:first-child {
  width: 10%;
  white-space: nowrap;
  text-align: center;
}

/* Equal widths for driver columns (2nd–4th) */
.driver-compare-table td:nth-child(2),
.driver-compare-table td:nth-child(3),
.driver-compare-table td:nth-child(4),
.driver-compare-table th:nth-child(2),
.driver-compare-table th:nth-child(3),
.driver-compare-table th:nth-child(4) {
  width: 30%;
}

.tyre-info {
  font-size: 1.4em;
  color: #ccc;
  /* margin-top: -25px; */
  font-family: monospace;
}

.fastest-lap {
  /* background-color: gold; */
  font-weight: bold;
  color: #fd01fd;
}

#simulate-btn {
  display: none;
  position: absolute;
  top: 20px;
  right: 50px;
}

@media screen and (max-width: 768px) {
  .table {
    min-width: 100%;
    max-width: 100%;
    top: calc(min(10vh, 10vw));
  }

  .driver-row {
    grid-template-columns: 5% 9% 10% 10% 11% 11% 11% 11% 11% 11%;
  }

  #flag-window {
    display:none;
  }

  #flag-display {
    display:none;
  }

  #news-window {
    display:none;
  }

  #radio-messages {
    display:none;
  }

  .cell {
    font-size: 2.4vw;
  }

  #header {
    font-size: 3vw;
  }

  #simulate-btn {
    display: none;
  }
}


/* No LiveTiming */
svg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  height: 100px;
}

text {
  font-size: 24px;
  fill: #f1f1f1;
  font-family: 'Courier New', monospace;
}

.letter {
  opacity: 0;
  animation: fadeIn 0.05s forwards;
}

#driverTooltip  {
  display:none;
  position:absolute;
  background:#222;
  color:#fff;
  font:1em sans-serif;
  padding:4px 8px;
  border-radius:4px;
  pointer-events:none;
  border:1px solid #555;
  z-index:2000;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

#debug {
  position: fixed;
  top: 0px;
  left: 0px;
}

#f1-disclaimer {
  text-align: center;
  font-size: 0.65em;
  color: #aaa;
  /* margin-top: 2em; */
  padding: 0px;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.0;
}

#countdownTimer {
  font-size: 1.0em;
  color: #ccc;
  margin-top: 10px;
  line-height: 1.4;
  white-space: pre-line;
}

#demo {
    font-size: 1em;
    padding: 10px 20px;
    background-color: #00ffcc;
    color: #000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 10px #00ffcc88;
  }