body {
  margin: 0;
  padding: 0;
  background-color: rgb(54, 54, 54);
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  overflow-x: auto; /* ← ajouter */
}

.main {
  position: relative;
  color: white;
  font-size: 11px;
  height: 90vh;
  min-width: 100vw;    /* ← remplacer width par min-width */
  width: max-content;  /* ← ajouter : .main s'élargit avec le tableau */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  gap: 5px;
}

table {
  border-spacing: 0;
  width: 97%;
  min-width: max-content; /* ← ajouter */
  border-collapse: collapse;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

span {
  margin-top: 50px;
}

.abrev {
  height: 50px;
}

.inter {
  max-width: 30px;
  position: relative;
  overflow: visible;
}

.abrev .arret {
  min-width: 30px;
}

tr {
  line-height: 15px;
}

td {
  position: relative;
  z-index: 1;
}

.voie > td {
  background-color: rgba(255, 217, 0, 1);
  z-index: 1;
}

.voie > td:first-child {
  background: linear-gradient(
    90deg,
    rgba(54, 54, 54, 1) 50%,
    rgba(255, 217, 0, 1) 50%,
    rgba(255, 217, 0, 1) 100%
  );
}

.voie > td:last-child {
  background: linear-gradient(
    270deg,
    rgba(54, 54, 54, 1) 50%,
    rgba(255, 217, 0, 1) 50%,
    rgba(255, 217, 0, 1) 100%
  );
}

.voie > td.arret::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background-color: rgba(255, 217, 0, 1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.menu {
  bottom: 0;
  width: 100vw;
  height: 10vh;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
}

.menu button {
  border-radius: 100%;
  font-size: 20px;
  background-color: white;
  border: none;
  padding: 20px;
  font-family: "Roboto", sans-serif;
  font-weight: 900;
  color: black;
}

.train {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateX(var(--offset-x, 0));

  width: 25px;
  height: 25px;
  border-radius: 50%;

  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  font-size: 10px;
  line-height: 9px;

  z-index: 10;
  pointer-events: auto;
}


.train:hover {
  z-index: 999;
  transform: translate(-50%, -50%) translateX(var(--offset-x, 0)) scale(1.2);
}

.train > * {
  position: relative;
  z-index: 2; 
}

/* Triangle séparé */
.train .triangle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  z-index: 1; /* derrière le cercle */

  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.train .cercle {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.train.aller .triangle {
  right: -6px;
  border-left: 8px solid var(--triangle-color);
}

.train.retour .triangle {
  left: -6px;
  border-right: 8px solid var(--triangle-color);
}

.tooltip {
    position: absolute;
    background-color: rgb(255, 255, 255);
    color: black;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11px;
    line-height: 18px;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transform: translate(-50%, -130%);
}

.tooltip.hidden {
    display: none;
}

.tooltip::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgb(255, 255, 255);
}

@media (max-width: 768px) {
  .main {
    font-size: 7px;
  }

  .train {
    width: 15px;
    height: 15px;
    font-size: 6px;
    line-height: 6px;
  }

  .abrev .arret {
    min-width: 20px;
  }

  .voie > td.arret::before {
    width: 6px;
    height: 6px;
  }

  .train.aller .triangle {
    right: -4px;
    border-left: 8px solid var(--triangle-color);
  }

  .train.retour .triangle {
    left: -4px;
    border-right: 8px solid var(--triangle-color);
  }

  .menu button {
  border-radius: 100%;
  font-size: 10px;
  background-color: white;
  border: none;
  padding: 10px;
  font-family: "Roboto", sans-serif;
  font-weight: 900;
  color: black;
}
}