/* Live Ticker — Persistent top-bar race display */

.live-ticker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-bottom: 2px solid #334155;
  padding: 6px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #e2e8f0;
  min-height: 40px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  overflow: hidden;
}

/* Dark mode handled by parent — ticker always dark for contrast */
.dark .live-ticker {
  background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
  border-bottom-color: #1e293b;
}

.ticker-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
  flex-wrap: nowrap;
}

.ticker-race {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ticker-label {
  background: #dc2626;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  animation: ticker-pulse 2s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes ticker-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.ticker-agents {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.ticker-agents::-webkit-scrollbar { display: none; }

.ticker-agent {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  border-left: 3px solid;
  background: rgba(255,255,255,0.05);
  white-space: nowrap;
  transition: background 0.2s;
}
.ticker-agent:hover {
  background: rgba(255,255,255,0.1);
}

.ticker-rank {
  font-size: 12px;
  min-width: 18px;
  text-align: center;
}

.ticker-online {
  color: #22c55e;
  font-size: 8px;
  animation: ticker-online-pulse 1.5s ease-in-out infinite;
}
@keyframes ticker-online-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ticker-offline {
  color: #6b7280;
  font-size: 8px;
}

.ticker-name {
  font-weight: 600;
  font-size: 12px;
}

.ticker-score {
  font-weight: 700;
  font-size: 13px;
}

.ticker-delta {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
}
.ticker-up {
  color: #22c55e;
  background: rgba(34,197,94,0.15);
}
.ticker-down {
  color: #ef4444;
  background: rgba(239,68,68,0.15);
}
.ticker-flat {
  color: #6b7280;
}

.ticker-tier {
  font-size: 12px;
}

.ticker-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 1;
  min-width: 0;
}

.ticker-narrative {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker-meta {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.ticker-season-warning {
  font-size: 11px;
  color: #fbbf24;
  font-weight: 600;
  animation: ticker-pulse 1.5s ease-in-out infinite;
  white-space: nowrap;
}

.ticker-loading {
  color: #64748b;
  font-size: 12px;
  text-align: center;
  width: 100%;
}

.ticker-empty {
  color: #64748b;
  font-size: 12px;
  text-align: center;
  width: 100%;
}

/* ─── Mobile ─────────────────────────────────────── */

@media (max-width: 768px) {
  .live-ticker {
    padding: 4px 8px;
    min-height: 36px;
  }

  .ticker-content {
    flex-wrap: wrap;
    gap: 4px;
  }

  .ticker-agents {
    gap: 4px;
  }

  .ticker-agent {
    padding: 2px 6px;
    gap: 3px;
  }

  .ticker-name {
    font-size: 11px;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ticker-info {
    width: 100%;
    justify-content: center;
  }

  .ticker-narrative {
    font-size: 11px;
  }

  .ticker-meta {
    display: none;
  }
}

@media (max-width: 480px) {
  .ticker-agent:nth-child(n+4) {
    display: none;
  }

  .ticker-delta {
    display: none;
  }
}
