:root {
  --line-color: #ffcd00;
  --line-text: #000;
  --panel: #fff;
  --ink: #1a1a1a;
  --led-on: #ff3b1f;
  --led-off: #c9c9c9;
  --station-width: 52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--line-color);
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

/* Bandeau : bande couleur / fond blanc / bande couleur */
.display {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.band {
  flex: 0 0 28px;
  background: var(--line-color);
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 0;
}

.line-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line-color);
  color: var(--line-text);
  font: inherit;
  font-weight: 700;
  font-size: 20px;
  cursor: pointer;
}

.direction {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.debug {
  margin-left: auto;
  font: 12px ui-monospace, Consolas, monospace;
  color: #666;
}

/* Ligne horizontale, défilable */
.track-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  align-items: flex-start;
  padding-top: 24px;
}
.track-scroll::-webkit-scrollbar { display: none; }

.track {
  position: relative;
  flex-shrink: 0;
  display: flex;
  margin: 0 auto;
  padding: 0 16px;
  list-style: none;
}

/* Trait de la ligne qui relie les points */
.track::before {
  content: "";
  position: absolute;
  top: 9px;
  left: calc(16px + var(--station-width) / 2);
  right: calc(16px + var(--station-width) / 2);
  height: 6px;
  background: var(--line-color);
}

.station {
  position: relative;
  flex: 0 0 var(--station-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

/* Point lumineux */
.led {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--led-on);
  border: 3px solid var(--panel);
  box-shadow: 0 0 0 2px var(--led-on), 0 0 10px 2px rgba(255, 59, 31, 0.6);
}

.station.passed .led {
  background: var(--led-off);
  box-shadow: 0 0 0 2px var(--led-off);
}

.station.current .led {
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    background: var(--led-off);
    box-shadow: 0 0 0 2px var(--led-off);
  }
}

/* Nom de la station, sous le point, lu de bas en haut */
.name-box {
  height: 210px;
  margin-top: 10px;
}

.name {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.station.passed .name { color: #9a9a9a; }

/* Correspondances, sous le nom */
.connections {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  width: var(--station-width);
  gap: 3px;
  margin-top: 10px;
  min-height: 24px;
}

.conn {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 3px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--c, #666);
}

.conn.metro { border-radius: 50%; color: var(--t, #fff); }
.conn.rer   { border-radius: 4px; color: var(--t, #fff); }
.conn.tram  { border-radius: 0; background: #fff; color: var(--ink); border-top: 3px solid var(--c); border-bottom: 3px solid var(--c); }

.station.passed .connections { opacity: 0.4; }

/* Écran de départ */
.start {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.start[hidden] { display: none; }

.start-card {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  background: var(--panel);
  border-top: 10px solid var(--line-color);
  border-bottom: 10px solid var(--line-color);
}

.start-title { margin: 0 0 8px; font-size: 22px; }
.start-subtitle { margin: 20px 0 8px; font-size: 16px; }
.start-status { margin: 0; color: #666; }
.start-status:empty { display: none; }

.nearby { list-style: none; margin: 0; padding: 0; }

.nearby-station {
  padding: 10px 0;
  border-bottom: 1px solid #e5e5e5;
}

.nearby-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}
.nearby-distance { color: #666; font-weight: 400; white-space: nowrap; }

.nearby-lines, .all-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.line-choice {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--c);
  color: var(--t);
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.all-lines-choices { flex-basis: 100%; }

.direction-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.direction-choice {
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
