/* --- Spectator Display Layout --- */
body {
  background-color: #0b0e14;
  color: #f0f6fc;
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
}

.spectator-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* --- Driver Info Header Card --- */
.driver-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.driver-number-badge {
  background: #21262d;
  color: #58a6ff;
  font-size: 3.5rem;
  font-weight: 900;
  width: 100px;
  height: 100px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #30363d;
  flex-shrink: 0;
}

.driver-details {
  flex-grow: 1;
}

.driver-name {
  font-size: 2.2rem;
  font-weight: 900;
  margin: 0 0 4px 0;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.driver-vehicle {
  font-size: 1.2rem;
  color: #8b949e;
  font-weight: 600;
  margin-bottom: 12px;
}

.driver-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.class-badge {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.3);
}

.club-badge {
  background: rgba(139, 148, 158, 0.15);
  color: #8b949e;
  border: 1px solid rgba(139, 148, 158, 0.3);
}

.pb-box {
  background: #0d1117;
  padding: 16px 20px;
  border-radius: 8px;
  border: 1px solid #21262d;
  text-align: right;
  flex-shrink: 0;
}

.pb-label {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.pb-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #e6edf3;
  font-family: monospace;
}

/* --- Telemetry Grid --- */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.telemetry-card {
  background: #161b22;
  border: 2px solid #30363d;
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #8b949e;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.card-value {
  font-size: 3.2rem;
  font-weight: 900;
  font-family: monospace;
  color: #ffffff;
  line-height: 1;
}

.status-indicator {
  margin-top: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #8b949e;
  text-transform: uppercase;
}

.speed-card {
  background: rgba(30, 41, 59, 0.5);
  border-color: #3b82f6;
}

.speed-unit {
  font-size: 0.9rem;
  font-weight: 800;
  color: #60a5fa;
  margin-top: 4px;
}

/* --- Motorsport Dynamic Colors --- */
/* Green = Personal Best */
.is-pb {
  border-color: #2ea043 !important;
  background: rgba(46, 160, 67, 0.12) !important;
}
.is-pb .card-value, .is-pb .status-indicator {
  color: #3fb950 !important;
}

/* Purple = Fastest of the Day (FTD) */
.is-ftd {
  border-color: #a855f7 !important;
  background: rgba(168, 85, 247, 0.15) !important;
}
.is-ftd .card-value, .is-ftd .status-indicator {
  color: #c084fc !important;
}

/* --- Legend Footer --- */
.color-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px;
  font-size: 0.85rem;
  color: #8b949e;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-pb { background-color: #3fb950; }
.dot-ftd { background-color: #c084fc; }

/* --- Mobile Styling --- */
@media (max-width: 768px) {
  .driver-card {
    flex-direction: column;
    text-align: center;
    padding: 16px;
    gap: 12px;
  }

  .driver-meta {
    justify-content: center;
  }

  .pb-box {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  .telemetry-grid {
    grid-template-columns: 1fr;
  }

  .card-value {
    font-size: 2.8rem;
  }
}