/* ===== ClaudeTuner Team Race — Embedded Component ===== */
/* All selectors scoped under .race-scene */

.race-scene {
  position: relative;
  width: 100%;
  max-height: 600px;
  overflow: hidden;
  border-radius: 16px;
  background: #1a1a2e;
  margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  aspect-ratio: 16 / 7;
}

/* ===== SKY ===== */
.race-scene .sky {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 25%;
  background: linear-gradient(180deg, #1e3a5f 0%, #38bdf8 30%, #7dd3fc 55%, #bae6fd 75%, #fef3c7 100%);
  z-index: 0;
}

.race-scene .sun {
  position: absolute;
  top: 3%; right: 10%;
  width: 55px; height: 55px;
  background: radial-gradient(circle, #fde68a 25%, #fbbf24 55%, rgba(251,191,36,0) 100%);
  border-radius: 50%;
  z-index: 1;
  animation: rc-sunPulse 4s ease-in-out infinite alternate;
}
.race-scene .sun::after {
  content: '';
  position: absolute;
  top: -15px; left: -15px; right: -15px; bottom: -15px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251,191,36,0.15) 0%, transparent 70%);
  animation: rc-sunGlow 3s ease-in-out infinite alternate;
}
@keyframes rc-sunPulse { 0% { transform: scale(1); } 100% { transform: scale(1.08); } }
@keyframes rc-sunGlow { 0% { opacity: 0.6; } 100% { opacity: 1; } }

/* Clouds */
.race-scene .rc-cloud {
  position: absolute;
  background: white;
  border-radius: 50px;
  opacity: 0.8;
  z-index: 1;
  animation: rc-cloudDrift linear infinite;
}
.race-scene .rc-cloud::before, .race-scene .rc-cloud::after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 50%;
}
.race-scene .rc-cloud-1 { top: 4%; width: 90px; height: 28px; animation-duration: 50s; }
.race-scene .rc-cloud-1::before { width: 38px; height: 38px; top: -18px; left: 14px; }
.race-scene .rc-cloud-1::after { width: 50px; height: 42px; top: -22px; left: 36px; }
.race-scene .rc-cloud-2 { top: 9%; width: 70px; height: 22px; animation-duration: 60s; animation-delay: -22s; }
.race-scene .rc-cloud-2::before { width: 32px; height: 32px; top: -16px; left: 10px; }
.race-scene .rc-cloud-2::after { width: 40px; height: 35px; top: -18px; left: 28px; }
.race-scene .rc-cloud-3 { top: 2%; width: 110px; height: 32px; animation-duration: 65s; animation-delay: -38s; }
.race-scene .rc-cloud-3::before { width: 45px; height: 45px; top: -22px; left: 18px; }
.race-scene .rc-cloud-3::after { width: 55px; height: 48px; top: -26px; left: 50px; }

@keyframes rc-cloudDrift {
  0% { transform: translateX(-250px); }
  100% { transform: translateX(calc(100% + 250px)); }
}

/* ===== GRANDSTAND ===== */
.race-scene .grandstand {
  position: absolute;
  top: 10%; left: 0; right: 0;
  height: 17%;
  z-index: 2;
  overflow: hidden;
}
.race-scene .grandstand-structure {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 100%;
  background: linear-gradient(180deg, #92400e 0%, #78350f 40%, #713f12 100%);
  clip-path: polygon(0% 38%, 2% 32%, 98% 32%, 100% 38%, 100% 100%, 0% 100%);
}
.race-scene .grandstand-roof {
  position: absolute;
  top: 0; left: 1%; right: 1%;
  height: 38%;
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  clip-path: polygon(0% 100%, 4% 15%, 50% 0%, 96% 15%, 100% 100%);
  z-index: 1;
}
.race-scene .crowd-row {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 2px;
  z-index: 2;
}
.race-scene .crowd-row:nth-child(3) { bottom: 55%; }
.race-scene .crowd-row:nth-child(4) { bottom: 40%; }
.race-scene .crowd-row:nth-child(5) { bottom: 25%; }
.race-scene .crowd-row:nth-child(6) { bottom: 10%; }

.race-scene .spectator {
  width: 7px; height: 11px;
  border-radius: 50% 50% 30% 30%;
  animation: rc-cheer ease-in-out infinite;
}
@keyframes rc-cheer {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* ===== GRASS STRIP ===== */
.race-scene .grass-strip {
  position: absolute;
  top: 25%; left: 0; right: 0;
  height: 3.5%;
  background: linear-gradient(180deg, #16a34a, #15803d);
  z-index: 3;
}
.race-scene .grass-strip::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 35%;
  background: repeating-linear-gradient(90deg, transparent, transparent 7px, rgba(0,0,0,0.07) 7px, rgba(0,0,0,0.07) 9px);
}

/* ===== TRACK AREA ===== */
.race-scene .track-area {
  position: absolute;
  top: 28.5%; left: 0; right: 0;
  bottom: 7%;
  background: linear-gradient(180deg, #a16207 0%, #92400e 15%, #78350f 50%, #713f12 85%, #92400e 100%);
  z-index: 3;
}
.race-scene .track-area::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle, rgba(0,0,0,0.05) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 11px 11px, 15px 15px;
  background-position: 0 0, 5px 8px;
}
.race-scene .track-shadow {
  position: absolute;
  top: 28.5%; left: 0; right: 0;
  height: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.3), transparent);
  z-index: 4;
}

/* ===== TRACK MARKINGS ===== */
.race-scene .track-markings {
  position: absolute;
  top: 28.5%; left: 0; right: 0;
  bottom: 7%;
  z-index: 5;
  pointer-events: none;
}
.race-scene .track-mark {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.1);
}
.race-scene .track-mark-label {
  position: absolute;
  top: -18px;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.45);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ===== FINISH LINE ===== */
.race-scene .finish-line {
  position: absolute;
  top: 28.5%; bottom: 7%;
  right: 4%;
  width: 16px;
  z-index: 6;
  background: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%) 0 0 / 8px 8px;
}
.race-scene .finish-line::before {
  content: 'FINISH';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 2px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  white-space: nowrap;
}

/* ===== DANGER ZONE ===== */
.race-scene .danger-zone {
  position: absolute;
  top: 28.5%; bottom: 7%;
  right: 4%;
  width: 18.4%;
  background: linear-gradient(90deg, transparent 0%, rgba(239,68,68,0.06) 20%, rgba(239,68,68,0.14) 100%);
  z-index: 4;
  pointer-events: none;
}
.race-scene .danger-zone::after {
  content: 'DANGER ZONE';
  position: absolute;
  bottom: 6px;
  right: 20px;
  font-size: 9px;
  font-weight: 800;
  color: rgba(248,113,113,0.35);
  letter-spacing: 3px;
}

/* ===== FLAGS ===== */
.race-scene .rc-flag {
  position: absolute;
  z-index: 7;
  width: 18px; height: 12px;
  clip-path: polygon(0 0, 100% 20%, 100% 80%, 0 100%);
  animation: rc-flagWave 0.5s ease-in-out infinite alternate;
  transform-origin: left center;
}
@keyframes rc-flagWave {
  0% { transform: scaleX(1) skewY(0deg); }
  100% { transform: scaleX(0.88) skewY(2.5deg); }
}

/* ===== BOTTOM GRASS ===== */
.race-scene .bottom-grass {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 7%;
  background: linear-gradient(180deg, #15803d, #166534);
  z-index: 3;
}

/* ===== LANES ===== */
.race-scene .lanes-container {
  position: absolute;
  top: 28.5%; left: 0; right: 0;
  bottom: 7%;
  z-index: 10;
}
.race-scene .lane-divider {
  position: absolute;
  left: 4%; right: 4%;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0px, rgba(255,255,255,0.08) 6px, transparent 6px, transparent 14px);
}
.race-scene .lane-number {
  position: absolute;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  z-index: 11;
}

/* ===== RACER ===== */
.race-scene .racer {
  position: absolute;
  z-index: 20;
  transition: left 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: drop-shadow(2px 3px 5px rgba(0,0,0,0.45));
}
.race-scene .racer.rank-1 { filter: drop-shadow(0 0 8px rgba(251,191,36,0.5)) drop-shadow(2px 3px 5px rgba(0,0,0,0.4)); }
.race-scene .racer.rank-2 { filter: drop-shadow(0 0 6px rgba(148,163,184,0.4)) drop-shadow(2px 3px 5px rgba(0,0,0,0.4)); }
.race-scene .racer.rank-3 { filter: drop-shadow(0 0 5px rgba(217,119,6,0.4)) drop-shadow(2px 3px 5px rgba(0,0,0,0.4)); }

.race-scene .horse-assembly {
  position: relative;
  width: 68px;
  height: 48px;
}

@keyframes rc-horseGallop {
  0%   { transform: translateY(0px) rotate(0deg); }
  15%  { transform: translateY(-4px) rotate(-1deg); }
  30%  { transform: translateY(-1px) rotate(0.5deg); }
  50%  { transform: translateY(1px) rotate(0deg); }
  65%  { transform: translateY(-3px) rotate(-0.5deg); }
  80%  { transform: translateY(0px) rotate(0.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

/* ===== HORSE PARTS ===== */
.race-scene .horse-body {
  position: absolute;
  bottom: 6px; left: 8px;
  width: 40px; height: 20px;
  border-radius: 50% 45% 40% 50%;
}
.race-scene .horse-head {
  position: absolute;
  bottom: 16px; right: 2px;
  width: 15px; height: 21px;
  border-radius: 40% 50% 30% 20%;
  transform: rotate(-20deg);
  transform-origin: bottom center;
  animation: rc-horseHeadBob linear infinite;
}
@keyframes rc-horseHeadBob {
  0%, 100% { transform: rotate(-20deg); }
  25% { transform: rotate(-26deg); }
  50% { transform: rotate(-14deg); }
  75% { transform: rotate(-22deg); }
}
.race-scene .horse-ear {
  position: absolute;
  top: -4px; right: 1px;
  width: 4px; height: 7px;
  border-radius: 50% 50% 20% 20%;
  transform: rotate(10deg);
}
.race-scene .horse-eye {
  position: absolute;
  top: 5px; right: 3px;
  width: 3px; height: 3px;
  background: #1c1917;
  border-radius: 50%;
}
.race-scene .horse-mane {
  position: absolute;
  bottom: 20px; right: 10px;
  width: 18px; height: 7px;
  border-radius: 50%;
  animation: rc-maneFlow ease-in-out infinite alternate;
}
@keyframes rc-maneFlow {
  0% { transform: translateX(0) scaleX(1); }
  100% { transform: translateX(-3px) scaleX(1.2); }
}
.race-scene .horse-tail {
  position: absolute;
  bottom: 14px; left: 2px;
  width: 13px; height: 5px;
  border-radius: 50%;
  transform-origin: right center;
  animation: rc-tailSwish linear infinite;
}
@keyframes rc-tailSwish {
  0%, 100% { transform: rotate(0deg) scaleX(1); }
  25% { transform: rotate(10deg) scaleX(1.15); }
  50% { transform: rotate(-6deg) scaleX(0.9); }
  75% { transform: rotate(4deg) scaleX(1.05); }
}

/* Horse legs */
.race-scene .horse-legs {
  position: absolute;
  bottom: 0; left: 12px;
  width: 36px; height: 13px;
}
.race-scene .horse-leg {
  position: absolute;
  bottom: 0;
  width: 4px; height: 13px;
  border-radius: 2px;
  transform-origin: top center;
}
.race-scene .horse-leg.fl { left: 24px; animation: rc-legFL linear infinite; }
.race-scene .horse-leg.fr { left: 28px; animation: rc-legFR linear infinite; }
.race-scene .horse-leg.bl { left: 4px; animation: rc-legBL linear infinite; }
.race-scene .horse-leg.br { left: 8px; animation: rc-legBR linear infinite; }

@keyframes rc-legFL {
  0% { transform: rotate(25deg); } 25% { transform: rotate(-32deg); }
  50% { transform: rotate(12deg); } 75% { transform: rotate(30deg); }
  100% { transform: rotate(25deg); }
}
@keyframes rc-legFR {
  0% { transform: rotate(-22deg); } 25% { transform: rotate(28deg); }
  50% { transform: rotate(-28deg); } 75% { transform: rotate(16deg); }
  100% { transform: rotate(-22deg); }
}
@keyframes rc-legBL {
  0% { transform: rotate(22deg); } 25% { transform: rotate(-28deg); }
  50% { transform: rotate(32deg); } 75% { transform: rotate(-16deg); }
  100% { transform: rotate(22deg); }
}
@keyframes rc-legBR {
  0% { transform: rotate(-28deg); } 25% { transform: rotate(22deg); }
  50% { transform: rotate(-22deg); } 75% { transform: rotate(28deg); }
  100% { transform: rotate(-28deg); }
}

/* ===== HORSE COLOR VARIANTS ===== */
.race-scene .horse-bay .horse-body { background: #8B4513; }
.race-scene .horse-bay .horse-head { background: #6F3610; }
.race-scene .horse-bay .horse-ear { background: #5C2D0E; }
.race-scene .horse-bay .horse-leg { background: #2c1810; }
.race-scene .horse-bay .horse-mane, .race-scene .horse-bay .horse-tail { background: #1a0f08; }

.race-scene .horse-black .horse-body { background: #3a3632; }
.race-scene .horse-black .horse-head { background: #2e2a27; }
.race-scene .horse-black .horse-ear { background: #252220; }
.race-scene .horse-black .horse-leg { background: #1c1917; }
.race-scene .horse-black .horse-mane, .race-scene .horse-black .horse-tail { background: #0f0d0c; }

.race-scene .horse-chestnut .horse-body { background: #a0522d; }
.race-scene .horse-chestnut .horse-head { background: #8B4513; }
.race-scene .horse-chestnut .horse-ear { background: #733a10; }
.race-scene .horse-chestnut .horse-leg { background: #6F3610; }
.race-scene .horse-chestnut .horse-mane, .race-scene .horse-chestnut .horse-tail { background: #c4721a; }

.race-scene .horse-grey .horse-body { background: #8a8480; }
.race-scene .horse-grey .horse-head { background: #7a7470; }
.race-scene .horse-grey .horse-ear { background: #6a6460; }
.race-scene .horse-grey .horse-leg { background: #5a5450; }
.race-scene .horse-grey .horse-mane, .race-scene .horse-grey .horse-tail { background: #b0aaa6; }

.race-scene .horse-palomino .horse-body { background: #d4a24c; }
.race-scene .horse-palomino .horse-head { background: #c49040; }
.race-scene .horse-palomino .horse-ear { background: #b48035; }
.race-scene .horse-palomino .horse-leg { background: #a07030; }
.race-scene .horse-palomino .horse-mane, .race-scene .horse-palomino .horse-tail { background: #f0e6d0; }

.race-scene .horse-roan .horse-body { background: #8b5e5e; }
.race-scene .horse-roan .horse-head { background: #7a4e4e; }
.race-scene .horse-roan .horse-ear { background: #6a4040; }
.race-scene .horse-roan .horse-leg { background: #5a3535; }
.race-scene .horse-roan .horse-mane, .race-scene .horse-roan .horse-tail { background: #3d2020; }

.race-scene .horse-dapple .horse-body { background: #6e6e6e; }
.race-scene .horse-dapple .horse-head { background: #5e5e5e; }
.race-scene .horse-dapple .horse-ear { background: #505050; }
.race-scene .horse-dapple .horse-leg { background: #404040; }
.race-scene .horse-dapple .horse-mane, .race-scene .horse-dapple .horse-tail { background: #e8e8e8; }

.race-scene .horse-sorrel .horse-body { background: #b5651d; }
.race-scene .horse-sorrel .horse-head { background: #a05818; }
.race-scene .horse-sorrel .horse-ear { background: #8b4c14; }
.race-scene .horse-sorrel .horse-leg { background: #7a4210; }
.race-scene .horse-sorrel .horse-mane, .race-scene .horse-sorrel .horse-tail { background: #d4a060; }

/* ===== JOCKEY ===== */
.race-scene .jockey {
  position: absolute;
  bottom: 24px; right: 12px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: white;
  border: 2px solid rgba(255,255,255,0.55);
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: transform 0.5s ease;
  overflow: hidden;
}
.race-scene .jockey-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.race-scene .jockey-body {
  position: absolute;
  bottom: 20px; right: 16px;
  width: 12px; height: 9px;
  border-radius: 3px 3px 5px 5px;
  z-index: 1;
  transition: transform 0.5s ease;
}

/* ===== RACER LABELS ===== */
.race-scene .racer-name {
  position: absolute;
  bottom: 72px; left: 50%;
  transform: translateX(-50%) scale(0.85);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: white;
  background: rgba(0,0,0,0.75);
  padding: 3px 10px;
  border-radius: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 1;
}
.race-scene .racer:hover {
  z-index: 99;
}
.race-scene .racer:hover .racer-name {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.race-scene .badge-5h {
  position: absolute;
  bottom: 52px; left: -8px;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  white-space: nowrap;
  transition: background 0.5s ease;
}

.race-scene .badge-7d {
  position: absolute;
  bottom: 40px; left: -4px;
  font-size: 8px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
  color: rgba(255,255,255,0.7);
  background: rgba(100,100,120,0.6);
  white-space: nowrap;
  backdrop-filter: blur(2px);
}

/* ===== DUST PARTICLES ===== */
.race-scene .dust-container {
  position: absolute;
  bottom: 0;
  left: -12px;
  width: 30px;
  height: 22px;
  pointer-events: none;
  z-index: -1;
}
.race-scene .dust-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(180, 140, 80, 0.45);
  pointer-events: none;
}

/* ===== SCOREBOARD ===== */
.race-scene .rc-scoreboard {
  position: absolute;
  top: 10px; left: 10px;
  width: 280px;
  background: rgba(10, 18, 35, 0.92);
  border-radius: 12px;
  padding: 12px 14px;
  z-index: 100;
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.race-scene .scoreboard-title {
  font-size: 10px;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.race-scene .scoreboard-title:hover {
  color: #fde68a;
}
.race-scene .sb-toggle {
  font-size: 8px;
  margin-left: auto;
  color: rgba(255,255,255,0.3);
  transition: transform 0.2s;
}
.race-scene .rc-scoreboard.collapsed .sb-toggle {
  transform: rotate(-90deg);
}
.race-scene .rc-scoreboard.collapsed .scoreboard-header,
.race-scene .rc-scoreboard.collapsed .scoreboard-entry {
  display: none;
}
.race-scene .rc-scoreboard.collapsed {
  padding: 10px 14px;
}
.race-scene .rc-scoreboard.collapsed .scoreboard-title {
  margin-bottom: 0;
}
.race-scene .live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: #ef4444;
  border-radius: 50%;
  animation: rc-livePulse 1.2s ease-in-out infinite;
}
@keyframes rc-livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.race-scene .scoreboard-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 2px;
}
.race-scene .scoreboard-header span {
  font-size: 8px;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.race-scene .sh-rank { width: 16px; text-align: center; }
.race-scene .sh-avatar { width: 18px; }
.race-scene .sh-name { flex: 1; }
.race-scene .sh-plan { width: 42px; text-align: center; }
.race-scene .sh-5h { width: 36px; text-align: right; }
.race-scene .sh-7d { width: 30px; text-align: right; }

.race-scene .scoreboard-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: all 0.4s ease;
  border-radius: 4px;
}
.race-scene .scoreboard-entry:last-child { border-bottom: none; }
.race-scene .scoreboard-entry.flash { background: rgba(251,191,36,0.12); }

.race-scene .sb-rank {
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,0.4);
  width: 16px;
  text-align: center;
}
.race-scene .sb-rank.gold { color: #fbbf24; }
.race-scene .sb-rank.silver { color: #94a3b8; }
.race-scene .sb-rank.bronze { color: #d97706; }

.race-scene .sb-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.race-scene .sb-avatar-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.race-scene .sb-name {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.race-scene .sb-plan {
  font-size: 7px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  width: 42px;
  text-align: center;
}
.race-scene .sb-5h {
  font-size: 10px;
  font-weight: 800;
  width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.race-scene .sb-7d {
  font-size: 9px;
  font-weight: 600;
  width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.35);
}

/* ===== INFO BADGE (top right) ===== */
.race-scene .info-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(10, 18, 35, 0.9);
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 100;
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.08);
  text-align: right;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.race-scene .info-badge-title {
  font-size: 9px;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.race-scene .info-badge-sub {
  font-size: 8px;
  color: rgba(255,255,255,0.35);
  margin-top: 2px;
}
.race-scene .info-badge-timer {
  font-size: 20px;
  font-weight: 800;
  color: white;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ===== TITLE BANNER ===== */
.race-scene .title-banner {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 7%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 50;
  pointer-events: none;
}
.race-scene .title-banner .title-text {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ===== OVERTAKE FLASH ===== */
.race-scene .overtake-flash {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 28px;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251,191,36,0.6), 0 2px 8px rgba(0,0,0,0.5);
  letter-spacing: 6px;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  animation: rc-overtakeAnim 1.2s ease-out forwards;
}
@keyframes rc-overtakeAnim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  30% { transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(0.95); }
}

/* ===== SPARKS ===== */
.race-scene .spark {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 25;
}

/* ===== COLOR UTILITY ===== */
.race-scene .color-red { color: #f87171; }
.race-scene .color-orange { color: #fb923c; }
.race-scene .color-purple { color: #a78bfa; }
.race-scene .color-cyan { color: #22d3ee; }


/* ============================================================ */
/* ===== FUN ANIMATIONS ===== */
/* ============================================================ */

/* --- Sweat Drops (speed decreasing) --- */
.race-scene .sweat-drop {
  position: absolute;
  width: 4px; height: 6px;
  background: #60a5fa;
  border-radius: 50% 50% 50% 0%;
  transform: rotate(-45deg);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  animation: rc-sweatFall 0.7s ease-in forwards;
}
@keyframes rc-sweatFall {
  0% { opacity: 0.8; transform: rotate(-45deg) translate(0, 0); }
  100% { opacity: 0; transform: rotate(-45deg) translate(-3px, 14px); }
}

/* --- Sleeping Zzz (very idle) --- */
.race-scene .zzz {
  position: absolute;
  font-size: 11px;
  font-weight: 900;
  color: #a78bfa;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  animation: rc-zzzFloat 2s ease-out forwards;
}
@keyframes rc-zzzFloat {
  0% { opacity: 0.9; transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { opacity: 0.7; transform: translate(6px, -12px) scale(0.8) rotate(-10deg); }
  66% { opacity: 0.4; transform: translate(12px, -22px) scale(0.6) rotate(5deg); }
  100% { opacity: 0; transform: translate(18px, -32px) scale(0.3) rotate(-5deg); }
}

/* --- Whip Crack (speed increasing fast) --- */
.race-scene .whip-line {
  position: absolute;
  width: 22px; height: 2px;
  background: linear-gradient(90deg, #92400e 0%, #d97706 60%, transparent 100%);
  border-radius: 1px;
  transform-origin: right center;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  animation: rc-whipSwing 0.25s ease-out forwards;
}
@keyframes rc-whipSwing {
  0% { opacity: 0.9; transform: rotate(-40deg) scaleX(0.4); }
  40% { opacity: 1; transform: rotate(35deg) scaleX(1.2); }
  100% { opacity: 0; transform: rotate(15deg) scaleX(0.8); }
}
/* Whip crack star burst */
.race-scene .whip-star {
  position: absolute;
  font-size: 10px;
  pointer-events: none;
  z-index: 31;
  opacity: 0;
  animation: rc-whipStar 0.4s ease-out forwards;
}
@keyframes rc-whipStar {
  0% { opacity: 1; transform: scale(0.5); }
  50% { opacity: 0.8; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(0.6); }
}

/* --- Jockey Bounce (sharp drop) --- */
.race-scene .racer.jockey-bouncing .jockey {
  animation: rc-jockeyBounce 0.5s ease-in-out infinite;
}
.race-scene .racer.jockey-bouncing .jockey-body {
  animation: rc-jockeyBounce 0.5s ease-in-out infinite;
}
@keyframes rc-jockeyBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-14px) rotate(12deg); }
  50% { transform: translateY(-6px) rotate(-8deg); }
  75% { transform: translateY(-10px) rotate(5deg); }
}

/* --- Jockey Fallen Off (extreme drop) --- */
.race-scene .racer.jockey-fallen .jockey {
  animation: rc-jockeyFall 1.5s ease-in forwards;
}
.race-scene .racer.jockey-fallen .jockey-body {
  animation: rc-jockeyFallBody 1.5s ease-in forwards;
}
@keyframes rc-jockeyFall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  30% { transform: translate(-8px, -20px) rotate(30deg); opacity: 1; }
  60% { transform: translate(-22px, -8px) rotate(90deg); opacity: 0.8; }
  100% { transform: translate(-35px, 12px) rotate(180deg); opacity: 0.5; }
}
@keyframes rc-jockeyFallBody {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  30% { transform: translate(-6px, -15px) rotate(25deg); opacity: 1; }
  60% { transform: translate(-18px, -5px) rotate(70deg); opacity: 0.7; }
  100% { transform: translate(-30px, 10px) rotate(150deg); opacity: 0.4; }
}

/* --- Runaway Horse (very high speed, jockey sliding back) --- */
.race-scene .racer.runaway .jockey {
  transform: translateX(-16px) rotate(20deg);
}
.race-scene .racer.runaway .jockey-body {
  transform: translateX(-14px) rotate(15deg);
}
/* Exclamation marks for runaway */
.race-scene .exclaim {
  position: absolute;
  font-size: 12px;
  font-weight: 900;
  color: #fbbf24;
  pointer-events: none;
  z-index: 31;
  opacity: 0;
  animation: rc-exclaimPop 0.6s ease-out forwards;
}
@keyframes rc-exclaimPop {
  0% { opacity: 0; transform: scale(0.3) translateY(0); }
  30% { opacity: 1; transform: scale(1.3) translateY(-8px); }
  100% { opacity: 0; transform: scale(0.8) translateY(-18px); }
}

/* --- Hearts (happy, stable low usage) --- */
.race-scene .heart {
  position: absolute;
  font-size: 10px;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  animation: rc-heartFloat 1.5s ease-out forwards;
}
@keyframes rc-heartFloat {
  0% { opacity: 0.9; transform: translateY(0) scale(1); }
  50% { opacity: 0.6; transform: translateY(-15px) scale(0.8); }
  100% { opacity: 0; transform: translateY(-28px) scale(0.4); }
}

/* --- Dizzy Stars (stumble on big drop) --- */
.race-scene .dizzy-star {
  position: absolute;
  font-size: 8px;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  animation: rc-dizzyOrbit 1.5s linear forwards;
}
@keyframes rc-dizzyOrbit {
  0% { opacity: 0.9; transform: rotate(0deg) translateX(12px) rotate(0deg); }
  50% { opacity: 0.7; transform: rotate(180deg) translateX(12px) rotate(-180deg); }
  100% { opacity: 0; transform: rotate(360deg) translateX(12px) rotate(-360deg); }
}

/* ============================================================ */
/* ===== 100% RESTING STATE ===== */
/* ============================================================ */
/* Horse stops running, grazes, jockey relaxes */
.race-scene .racer.resting .horse-assembly {
  animation: none !important;
}
.race-scene .racer.resting .horse-leg {
  animation: none !important;
  transform: rotate(0deg) !important;
}
.race-scene .racer.resting .horse-head {
  animation: none !important;
  transform: rotate(-5deg) translateY(4px) !important; /* head down, grazing */
}
.race-scene .racer.resting .horse-mane {
  animation: none !important;
}
.race-scene .racer.resting .horse-tail {
  animation-duration: 3s !important; /* slow lazy swish */
}
/* Jockey leans back, relaxed */
.race-scene .racer.resting .jockey {
  transform: translateY(-2px) rotate(-8deg);
}
.race-scene .racer.resting .jockey-body {
  transform: translateY(-2px) rotate(-5deg);
}
/* Grass nibble effect */
.race-scene .nibble {
  position: absolute;
  font-size: 8px;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  animation: rc-nibble 1.2s ease-out forwards;
}
@keyframes rc-nibble {
  0% { opacity: 0.7; transform: translate(0, 4px) scale(0.8); }
  50% { opacity: 0.5; transform: translate(2px, 2px) scale(1); }
  100% { opacity: 0; transform: translate(4px, 0px) scale(0.6); }
}
/* Finish flag on resting horse */
.race-scene .finish-flag {
  position: absolute;
  top: -8px; right: 10px;
  font-size: 14px;
  z-index: 31;
  animation: rc-flagCelebrate 2s ease-in-out infinite;
}
@keyframes rc-flagCelebrate {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* ===== CLOCK (bottom right) ===== */
.race-scene .rc-clock {
  position: absolute;
  bottom: 10px; right: 10px;
  background: rgba(10, 18, 35, 0.85);
  padding: 6px 12px;
  border-radius: 8px;
  z-index: 100;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  font-variant-numeric: tabular-nums;
}
.race-scene .rc-clock-time {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .race-scene .rc-scoreboard { width: 200px; padding: 8px 10px; }
  .race-scene .sh-plan, .race-scene .sb-plan { display: none; }
  .race-scene .sh-7d, .race-scene .sb-7d { display: none; }
  .race-scene .info-badge { padding: 6px 10px; }
  .race-scene .info-badge-timer { font-size: 16px; }
}
@media (max-width: 480px) {
  .race-scene .rc-scoreboard { display: none; }
  .race-scene .racer-name { font-size: 10px; }
  .race-scene .badge-5h { font-size: 9px; }
}

/* Pause state — freeze all CSS animations */
.race-scene.race-paused * { animation-play-state: paused !important; }

/* Idle overlay */
.race-scene .race-idle-overlay {
  position: absolute; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
}
.race-scene .race-idle-msg {
  color: white; font-size: 18px; font-weight: 700;
  text-align: center; line-height: 1.6;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
