/* ═══ §8 · TAB: RACE ══════════════════════════════════════════════════════════════════ */

/* the header — title left, the labelled REWIND pill right. #202: this is an accepted design. */
.race-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 6px;
  gap: 8px;
}
.race-header-title {
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  opacity: 0.75;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.race-rewind-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.10);
  border: 1px solid rgba(0, 229, 255, 0.35);
  cursor: pointer;
  transition: all 0.18s ease;
}
.race-rewind-btn:hover { background: rgba(0, 229, 255, 0.18); }
.race-rewind-btn:active { transform: scale(0.97); }
.race-rewind-btn svg { flex-shrink: 0; }

.race-status {
  padding: 0 4px 8px;
  font-size: 0.6rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  /* IT WRAPS. "AFTER_HOURS · feed LIVE · 240 sub · 2,003 seen" is 395px of ink in a 366px
     column at 390px, and an ellipsis here eats the two facts at the END of the line. */
  white-space: normal;
  overflow-wrap: anywhere;
}

.race-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.race-bar {
  padding: var(--sp-md) var(--sp-lg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  position: relative;
  overflow: hidden;
}
.race-bar.rank-1 {
  border-color: rgba(255, 215, 0, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 215, 0, 0.1);
}
.race-bar.rank-1::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), transparent 60%);
  pointer-events: none;
}
.race-bar.entering { animation: barEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes barEnter {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.race-bar.flash-up   { animation: flashUp 0.65s ease-out; }
.race-bar.flash-down { animation: flashDown 0.65s ease-out; }
@keyframes flashUp {
  0%   { box-shadow: 0 0 0 0 rgba(33, 133, 75, 0); background: var(--glass-bg); }
  20%  { box-shadow: 0 0 24px 4px rgba(33, 133, 75, 0.45); background: rgba(33, 133, 75, 0.18); }
  100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); background: var(--glass-bg); }
}
@keyframes flashDown {
  0%   { box-shadow: 0 0 0 0 rgba(199, 78, 10, 0); background: var(--glass-bg); }
  20%  { box-shadow: 0 0 24px 4px rgba(199, 78, 10, 0.45); background: rgba(199, 78, 10, 0.15); }
  100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); background: var(--glass-bg); }
}

.race-bar-header {
  display: flex;
  align-items: center;
  /* the scanner + belief chips WRAP under the ticker at 390px instead of clipping the
     %change/price off the edge */
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-xs);
}
/* the chip group — the scanner-attribution chip and the belief chip travel together, so they
   wrap as ONE unit rather than the belief chip stranding on its own line. */
.race-bar-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex-wrap: wrap;
}
.race-bar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.rank-badge.rank-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 160, 0, 0.2));
  border-color: rgba(255, 215, 0, 0.4);
  color: var(--accent-gold);
  box-shadow: var(--glow-gold);
}
.rank-badge.rank-top5 {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
}

.ticker-symbol {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
  letter-spacing: 0.03em;
}
.pct-change {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  text-align: right;
}
.pct-change.positive { color: var(--accent-green-bright); }
.pct-change.negative { color: var(--accent-red-bright); }
.last-price {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  min-width: 60px;
}
.volume-text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: right;
  min-width: 45px;
}

/* the "?" affordance on every row — opens the Why modal */
.race-why-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: 50%;
  background: rgba(58, 255, 138, 0.18);
  color: var(--outcome-win);
  border: 1px solid rgba(58, 255, 138, 0.4);
  font-size: 0.6rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.race-why-btn:hover { background: rgba(58, 255, 138, 0.32); }

