/* The scene fills the original 414 × 896 frame. Gameplay and artwork stay independent. */
.live-race .rally-canyon {
  background: linear-gradient(#321a1466 0 26%,transparent 35%), #874221 url(assets/race-rally/canyon.jpg) center / 100% 100%;
}
.live-race #game { gap: 6px; padding: 2px 12px 5px; }
.live-race #game > header { justify-content: center; }
.live-race #level { color: #fff8ef; font: 700 20px/28px MiSans,"PingFang SC",sans-serif; text-shadow: 0 2px 5px #35160c; }
.live-race #status { margin-top: 2px; padding: 7px 0; color: #1a1f28; background: #fffdfa; box-shadow: 0 3px 8px #3a1b1540; }
.live-race #status > div { flex: 1; line-height: 18px; }
.live-race #status > div + div { border-left: 1px solid #dddfe3; }
.live-race #status strong {
  display: flex; justify-content: center; align-items: center; gap: 4px;
  margin-top: 4px; font: 700 22px/26px MiSans,"PingFang SC",sans-serif; font-variant-numeric: tabular-nums;
}
.live-race #status small { font: 500 13px/16px "PingFang SC",sans-serif; }
.live-race #hint { min-height: 20px; padding: 0; text-align: center; text-shadow: 0 1px 4px #421b0e; }
.live-race #stage { display: flex; flex: 1; flex-direction: column; min-height: 0; gap: 7px; }
.race-road {
  --road-offset: 0px;
  position: relative; flex: 1; min-height: 160px; overflow: hidden;
  border: 7px solid #dcaf80; border-radius: 12px;
  background: #7b4c31 url(assets/race-rally/canyon.jpg) center 45% / 105% auto;
  box-shadow: 0 5px 12px #42200f70,inset 0 0 7px #321a15;
  isolation: isolate;
}
.race-surface {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg,#5d3c29 1%,transparent 13%,#241b1520 50%,transparent 87%,#62412b 99%),
    url(assets/race-rally/asphalt.jpg) 50% var(--road-offset) / 100% 420px repeat-y;
  clip-path: polygon(9% 0,91% 0,100% 100%,0 100%);
  box-shadow: inset 0 0 30px #21150ba3;
}
.race-road::before,.race-road::after {
  content: ""; position: absolute; inset: 0 auto 0 33.33%; z-index: 1; width: 3px;
  background: repeating-linear-gradient(to bottom,#f4dfba 0 25px,transparent 25px 49px) 0 var(--road-offset);
  filter: drop-shadow(1px 1px 0 #543e2d);
}
.race-road::after { left: 66.67%; }
.race-car,.race-object {
  position: absolute; left: calc((var(--lane) + .5) * 100% / 3); transform: translate(-50%,-50%);
  z-index: 2;
}
.race-car { width: 57px; height: 88px; filter: drop-shadow(4px 7px 4px #1e100caa); }
.race-car > span {
  position: absolute; inset: 0; background: center / 100% 100% no-repeat;
  clip-path: polygon(26% 5%,42% 2%,62% 2%,78% 6%,87% 17%,96% 28%,98% 83%,91% 93%,78% 97%,24% 97%,9% 92%,5% 81%,5% 29%,14% 17%);
}
.race-player { z-index: 3; transition: left .16s cubic-bezier(.25,.67,.35,1); }
.race-player > span { background-image: url(assets/race-rally/player.jpg); }
.race-rival > span { background-image: url(assets/race-rally/rival.jpg); }
.race-object { width: 67px; height: 34px; background: center / 100% 100% no-repeat; }
.is-boost {
  background-image: url(assets/race-rally/boost.jpg);
  clip-path: inset(2% 1% 1% round 7px);
}
.is-block {
  height: 37px; background-image: url(assets/race-rally/block.jpg);
  clip-path: polygon(6% 3%,94% 2%,99% 85%,89% 93%,88% 99%,76% 99%,75% 92%,23% 93%,23% 99%,11% 99%,11% 92%,1% 84%);
}
.race-finish {
  position: absolute; width: 100%; height: 18px; transform: translateY(-50%); z-index: 1;
  background: repeating-conic-gradient(#f3e2c6 0% 25%,#312419 0% 50%) 0 / 18px 18px;
}
.race-banner,.race-pop {
  position: absolute; z-index: 4; text-align: center; color: #fff5e5;
  font: 700 23px/1.28 MiSans,"PingFang SC",sans-serif; pointer-events: none;
}
.race-banner { inset: 34% 17% auto; padding: 10px 4px; border: 1px solid #e5bb80; border-radius: 9px; background: #2e1c15ed; box-shadow: 0 4px 16px #260e0870; }
.race-road[data-phase="countdown"] .race-banner { inset-inline: 35%; color: #ffe68c; font-size: 43px; }
.race-road[data-phase="won"] .race-banner { color: #ffe89c; border-color: #ffe08b; }
.race-pop { inset: 56% 18% auto; font-size: 20px; text-shadow: 0 2px 2px #2d1a10,0 0 10px #2d1a10; }
.race-road[data-feedback="boost"] .race-pop { color: #dfff9d; }
.race-road[data-feedback="block"] .race-pop { color: #ffc1a8; }
.race-pop:not([hidden]) { animation: rally-pop .8s ease-out both; }
.race-road[data-feedback="block"] .race-player { animation: rally-impact .34s ease-out; }
.race-streaks {
  position: absolute; inset: 0; opacity: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(90deg,transparent 0 23px,#ffe18b55 24px 25px,transparent 26px 43px);
  mask-image: linear-gradient(transparent 25%,#000 77%,transparent);
}
.race-road[data-speed="boost"] .race-streaks { opacity: 1; animation: rally-streak .78s ease-out both; }
.race-road[data-speed="boost"] .race-player { filter: drop-shadow(0 0 8px #d9ff60) drop-shadow(4px 7px 4px #1e100caa); }
@keyframes rally-streak { from { translate: 0 -16%; opacity: .7; } to { translate: 0 30%; opacity: 0; } }
@keyframes rally-pop { 0% { translate: 0 7px; opacity: 0; } 14%,66% { opacity: 1; } 100% { translate: 0 -15px; opacity: 0; } }
@keyframes rally-impact { 22%,72% { translate: -3px 3px; } 43% { translate: 4px 6px; } }
.race-steer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.race-steer button {
  min-height: 58px; border-radius: 9px; background: #f5eee1; color: #25231e;
  font: 700 19px/24px MiSans,"PingFang SC",sans-serif; box-shadow: 0 3px 7px #371b1060;
}
.race-steer button:active:enabled { background: #ffe68b; translate: 0 2px; }
.live-race .rally-canyon { padding-bottom: 20px; }
.live-race [data-name="底部操作"] .frame-primary:disabled { opacity: 1; background: #c9aa25; }
@media (prefers-reduced-motion: reduce) {
  .race-player { transition: none; }
  .race-pop:not([hidden]),.race-road[data-feedback="block"] .race-player { animation: none; }
  .race-road[data-speed="boost"] .race-streaks { display: none; }
}
