/* The public game and the admin preview use the same stage and launch screen. */
:root { --player-stage-height: clamp(320px, 82vw, 400px); }
@media (min-width: 781px) {
  :root { --player-stage-height: clamp(440px, 68svh, 650px); }
}

.race-stage {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; place-items: center; align-self: start;
  width: 100%; min-height: 0; padding: 20px; box-sizing: border-box; color: #fff;
  font: 15px/1.45 system-ui, 'Segoe UI', sans-serif;
  background: radial-gradient(ellipse at 78% 16%, #5a457c 0, transparent 55%),
              linear-gradient(135deg, #24264a, #3b3157 70%, #312643);
  border-radius: 12px;
}
.race-stage:not(.is-expanded, :fullscreen) {
  /* Reserve the outer box independently of the game and its pre-roll. */
  block-size: var(--game-stage-height, var(--player-stage-height));
}
.race-stage.is-playing { padding: 0; background: #171426; }
.race-stage.is-playing > .course, .race-stage .launch[hidden] { display: none; }
.race-stage > iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.race-stage > .player-loading { inset-block-start: var(--game-bar-height, 0px); pointer-events: none; }

.launch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.launch {
  display: grid; grid-template-columns: clamp(96px, 11vw, 112px) minmax(0, 1fr);
  align-items: center; width: min(100%, 780px); gap: clamp(14px, 2vw, 24px);
}
.launch::before {
  content: ''; position: absolute; z-index: -1; inset: -24px; pointer-events: none;
  background: radial-gradient(ellipse at 85% 30%, #6b4e76, transparent 65%), linear-gradient(120deg, #24213e, #393054);
}
.game-art {
  display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain;
  border: 1px solid #ffffff24; border-radius: 12px; box-shadow: 0 12px 30px #17132966;
}
.launch-copy { min-width: 0; }
.launch .series { text-decoration: none; color: #e3d8f5; font-size: 13px; font-weight: 700; }
.launch a.series:hover { text-decoration: underline; }
.launch .launch-title {
  max-inline-size: 24ch; margin: 6px 0 12px; color: #fff;
  font-size: clamp(24px, 3vw, 43px); line-height: 1.1; letter-spacing: -.025em;
  text-wrap: balance; overflow-wrap: anywhere;
}
.launch-stats { display: flex; flex-wrap: wrap; gap: 7px 12px; margin: 0 0 16px; padding: 0; list-style: none; font-size: .86rem; color: #f2ecff; }
.launch-stats li { display: inline-flex; align-items: center; gap: 5px; }
.launch-stats li + li { padding-inline-start: 12px; border-inline-start: 1px solid #e0cff55c; }
.launch-stats :is(img, svg), .launch-play-icon { flex: none; width: 17px; height: 17px; }
.launch-stats img, .launch-actions [data-game-controls] img { filter: brightness(0) invert(1); }
.launch .playlink {
  background: #ffda67; color: #302942; padding: 10px 17px; border-radius: 7px;
  font: 700 15px/1.3 system-ui, sans-serif; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.launch button.playlink { border: 0; font-family: inherit; cursor: pointer; }
.launch .playlink[aria-busy=true] { cursor: progress; }
.launch-play-spinner, .launch-play-wait, .playlink[aria-busy=true] :is(.launch-play-icon, .launch-play-label) { display: none; }
.playlink[aria-busy=true] .launch-play-wait { display: inline; }
.playlink[aria-busy=true] .launch-play-spinner {
  display: inline-block; width: 14px; height: 14px; box-sizing: border-box;
  border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
  animation: launch-play-spin .75s linear infinite;
}
@keyframes launch-play-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .playlink .launch-play-spinner { animation: none; } }
.race-stage > .player-loading [data-game-retry] { pointer-events: auto; }

@media (max-width: 480px) {
  .launch { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 12px; text-align: center; }
  .launch .game-art { width: clamp(88px, 23vw, 96px); }
  .launch .launch-title { margin-inline: auto; font-size: clamp(21px, 5.8vw, 26px); }
  .launch .launch-actions, .launch-stats { justify-content: center; }
}
