/* ── Turn labels ─────────────────────────────────────────────────────────── */


.turn-label-marker-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  white-space: nowrap;
  overflow: visible;
  position: absolute;
  left: 0;
  top: 0;
}

/* Leaflet divIcon wrapper — must not clip */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}








.turn-label-number {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  line-height: 1;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.turn-label-name-side {
  font-size: 0.5rem;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.7);
  white-space: nowrap;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.light-theme .turn-label-name-side {
  color: #111122;
  text-shadow: 0 1px 3px rgba(255,255,255,0.9), 0 0 6px rgba(255,255,255,0.7);
}

/* ── Straight labels ─────────────────────────────────────────────────────── */



.straight-label-icon {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.straight-label {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.7);
  white-space: nowrap;
  pointer-events: none;
  transform-origin: center center;
  display: block;
  text-align: center;
  width: 120px;
  overflow: visible;
}

body.light-theme .straight-label {
  text-shadow: 0 1px 3px rgba(255,255,255,0.95),
               0 0 8px rgba(255,255,255,0.8);
}










body.light-theme .straight-label {
  text-shadow: 0 1px 3px rgba(255,255,255,0.9), 0 0 6px rgba(255,255,255,0.7);
}

/* ── History overlay — desktop ───────────────────────────────────────────── */
#circuit-history-overlay {
  position: absolute;
  z-index: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

#circuit-history-overlay.visible {
  opacity: 1;
}



#circuit-history-overlay.position-right {
  top: 50%;
  right: 376px;
  transform: translateY(-50%);
  text-align: left;
  max-width: 210px;
}





#circuit-history-overlay.position-left {
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  text-align: left;
  max-width: 210px;
}




#circuit-history-overlay.position-bottom {
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  max-width: calc(100% - 400px);
}

.history-overlay-title {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.6);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  margin-bottom: 8px;
}

body.light-theme .history-overlay-title {
  color: rgba(0,0,0,0.5);
  text-shadow: 0 1px 4px rgba(255,255,255,0.9);
}

.history-overlay-stat {
  margin-bottom: 5px;
}

.history-overlay-label {
  font-size: 0.48rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  display: block;
  margin-bottom: 1px;
}

body.light-theme .history-overlay-label {
  color: rgba(0,0,0,0.45);
  text-shadow: 0 1px 3px rgba(255,255,255,0.9);
}

.history-overlay-value {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8), 0 0 8px rgba(0,0,0,0.5);
  display: block;
}

body.light-theme .history-overlay-value {
  color: #111122;
  text-shadow: 0 1px 4px rgba(255,255,255,0.9), 0 0 8px rgba(255,255,255,0.6);
}

.history-overlay-accent { color: var(--accent); }

.history-overlay-divider {
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 6px 0;
}

body.light-theme .history-overlay-divider {
  background: rgba(0,0,0,0.1);
}

/* ── Mobile history bottom bar ───────────────────────────────────────────── */
#circuit-history-mobile {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 700;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  padding: 10px 14px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 100%);
}

body.light-theme #circuit-history-mobile {
  background: linear-gradient(to top, rgba(255,255,255,0.75) 0%, transparent 100%);
}

#circuit-history-mobile.visible {
  opacity: 1;
  transform: translateY(0);
}

.history-mobile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.history-mobile-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.history-mobile-label {
  font-size: 0.44rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

body.light-theme .history-mobile-label {
  color: rgba(0,0,0,0.45);
  text-shadow: 0 1px 3px rgba(255,255,255,0.9);
}

.history-mobile-value {
  font-size: 0.68rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

body.light-theme .history-mobile-value {
  color: #111122;
  text-shadow: 0 1px 4px rgba(255,255,255,0.9);
}

.history-mobile-accent { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (min-width: 769px) {
  #circuit-history-mobile { display: none; }
}

@media (max-width: 768px) {
  #circuit-history-overlay { display: none; }
}