/* Action Race — close-up cinematic side view */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030508;
  color: #e2e8f0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
body.action-race-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.action-race-chrome {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(8px, env(safe-area-inset-top, 8px)) max(14px, env(safe-area-inset-right, 14px)) 8px max(14px, env(safe-area-inset-left, 14px));
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.95), rgba(10, 14, 24, 0.6));
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
  z-index: 10;
}
body.action-race-racing .action-race-chrome {
  opacity: 0.35;
  transition: opacity 0.4s ease;
}
body.action-race-racing .action-race-chrome:hover,
body.action-race-racing .action-race-chrome:focus-within {
  opacity: 1;
}
.action-race-brand {
  font-family: Rajdhani, system-ui, sans-serif;
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: #fbbf24;
  text-transform: uppercase;
}
.action-race-meta {
  font-family: Rajdhani, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #94a3b8;
}
.action-race-link {
  color: #2dd4bf;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 6px;
}
.action-race-link:hover { color: #5eead4; border-color: rgba(45, 212, 191, 0.6); }
.action-race-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.action-vibe-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 20px;
  border: 1px solid rgba(168, 130, 255, 0.4);
  background: rgba(40, 30, 70, 0.5);
  color: #c4b5fd;
  font-family: Rajdhani, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.25s ease;
  min-height: 34px;
}
.action-vibe-toggle .vibe-icon { font-size: 1rem; line-height: 1; }
.action-vibe-toggle:hover { border-color: rgba(168, 130, 255, 0.7); color: #ddd6fe; }
.action-vibe-toggle[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(124, 92, 220, 0.55), rgba(76, 56, 150, 0.55));
  border-color: rgba(168, 130, 255, 0.9);
  color: #f5f3ff;
  box-shadow: 0 0 16px rgba(124, 92, 220, 0.4);
}
.action-vibe-toggle[aria-pressed="true"] .vibe-icon {
  animation: vibe-pulse 1.6s ease-in-out infinite;
}
@keyframes vibe-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.18); }
}

/* Moody idle poster — AI key art between races */
.action-race-poster {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #05060b center/cover no-repeat;
  background-image: url('/assets/vibe-bg.jpg?v=3.1.0');
  opacity: 1;
  transition: opacity 0.9s ease;
  pointer-events: none;
}
body.action-race-racing .action-race-poster {
  opacity: 0;
}
.action-race-poster-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(5, 8, 16, 0) 0%, rgba(5, 8, 16, 0.55) 78%),
    linear-gradient(180deg, rgba(5, 8, 16, 0.55) 0%, rgba(5, 8, 16, 0.1) 40%, rgba(5, 8, 16, 0.85) 100%);
}
.action-race-poster-text {
  position: absolute;
  left: max(20px, env(safe-area-inset-left, 20px));
  bottom: 18%;
  max-width: 80%;
}
.poster-kicker {
  font-family: Rajdhani, system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  color: #a882ff;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.poster-title {
  font-family: Rajdhani, system-ui, sans-serif;
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.04;
  color: #f5f3ff;
  text-shadow: 0 2px 30px rgba(124, 92, 220, 0.5), 0 2px 8px rgba(0, 0, 0, 0.8);
}
.poster-title span {
  font-size: 0.5em;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.08em;
}
@media (prefers-reduced-motion: reduce) {
  .action-vibe-toggle[aria-pressed="true"] .vibe-icon { animation: none; }
}

/* SFX toggle uses the same pill shape as Vibe but a teal accent so the two
   controls (soundtrack vs. race SFX/announcer) read as distinct switches. */
.action-sfx-toggle {
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(15, 40, 40, 0.5);
  color: #5eead4;
}
.action-sfx-toggle:hover { border-color: rgba(45, 212, 191, 0.7); color: #99f6e4; }
.action-sfx-toggle[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.5), rgba(13, 120, 105, 0.5));
  border-color: rgba(45, 212, 191, 0.9);
  color: #f0fdfa;
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.35);
  animation: none;
}
.action-sfx-toggle[aria-pressed="false"] .vibe-icon { opacity: 0.55; }

/* Broadcast caption — B17 announcer commentary, docked below the chrome. */
.action-announcer-cap {
  position: absolute;
  top: max(60px, calc(env(safe-area-inset-top, 0px) + 54px));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92%, 560px);
  padding: 7px 16px;
  border-radius: 20px;
  background: rgba(6, 10, 18, 0.68);
  border: 1px solid rgba(74, 222, 128, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Rajdhani, system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  color: #4ade80;
  letter-spacing: 0.02em;
  z-index: 6;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s ease;
}
.action-announcer-mic { font-size: 0.85rem; opacity: 0.85; flex: 0 0 auto; }
#action-announcer-text:empty { opacity: 0; }

.action-race-stage {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  background: #000;
}
#action-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.action-race-status {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom, 14px));
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(251, 191, 36, 0.25);
  font-family: Rajdhani, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fbbf24;
  pointer-events: none;
  z-index: 5;
}
.action-race-status.is-error { color: #f87171; border-color: rgba(248, 113, 113, 0.4); }
.action-race-live {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 6px;
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  border-radius: 3px;
  animation: action-live-pulse 1.2s ease-in-out infinite;
}
@keyframes action-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.action-race-results {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  z-index: 100;
  text-align: center;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.action-race-results.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.action-race-results-title {
  font-family: Rajdhani, system-ui, sans-serif;
  font-weight: 900;
  font-size: 2.2rem;
  letter-spacing: 0.08em;
  color: #fbbf24;
  text-transform: uppercase;
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.5), 0 2px 8px rgba(0, 0, 0, 0.8);
}
.action-race-results-places {
  margin-top: 12px;
  padding: 10px 22px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 10px;
  font-family: Rajdhani, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #e2e8f0;
  letter-spacing: 0.04em;
}