.rally {
  padding: 54px 0 80px;
}
.rally-head {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  align-items: end;
  margin-bottom: 24px;
}
.rally-head h2 {
  font:
    clamp(52px, 7vw, 92px)/0.9 Georgia,
    serif;
  margin: 10px 0 18px;
  letter-spacing: -0.05em;
}
.rally-head h2 em {
  font-style: normal;
  color: var(--red);
}
.rally-head > div > p:last-child {
  font-size: 17px;
  color: var(--muted);
  max-width: 650px;
  line-height: 1.6;
}
.rally-how {
  display: grid;
  gap: 6px;
  border-left: 4px solid var(--red);
  padding: 9px 0 9px 18px;
  min-width: 225px;
  color: var(--muted);
  font-size: 14px;
}
.rally-how b {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink);
}
.rally-shell {
  background: #121b1f;
  padding: 18px;
  box-shadow: 0 24px 60px #0003;
}
.rally-picker {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 0 18px;
  color: white;
}
.rally-picker > p {
  font-weight: 800;
  min-width: 125px;
}
.racer-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex: 1;
}
.racer-options button {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  text-align: left;
  border: 1px solid #ffffff26;
  background: #ffffff0a;
  color: white;
  padding: 7px 10px;
}
.racer-options button.active {
  border-color: #f5cc43;
  background: #f5cc4318;
  box-shadow: inset 0 -3px #f5cc43;
}
.racer-options img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  grid-row: 1/3;
}
.racer-options b {
  font-size: 14px;
}
.racer-options small {
  color: #aeb9bd;
  font-size: 11px;
}
.rally-start,
.rally-result button {
  border: 0;
  background: var(--red);
  color: white;
  font-weight: 900;
  padding: 15px 22px;
}
.rally-stage {
  position: relative;
  overflow: hidden;
  background: #82cef0;
  aspect-ratio: 16/9;
}
.rally-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.rally-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 7px;
}
.rally-hud span {
  display: grid;
  background: #111c;
  color: #fff;
  padding: 7px 11px;
  font-size: 10px;
  letter-spacing: 0.1em;
}
.rally-hud b {
  font-size: 18px;
  letter-spacing: 0;
}
.boost-meter {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}
.boost-meter i {
  display: block;
  width: 130px;
  height: 12px;
  border: 2px solid white;
  background: #111a;
  transform: skew(-12deg);
  padding: 2px;
}
.boost-meter b {
  display: block;
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #43d8ff, #f5e942);
}
.rally-result {
  position: absolute;
  inset: 0;
  background: #0f171de8;
  color: white;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 25px;
}
.rally-result[hidden] {
  display: none;
}
.rally-result > span {
  font-size: 54px;
}
.rally-result h3 {
  font:
    46px Georgia,
    serif;
  margin: 5px;
}
.rally-result p:not(.overline) {
  color: #c8d0d3;
}
.rally-result button {
  justify-self: center;
}
.rally-controls {
  display: none;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 10px;
  padding-top: 14px;
}
.rally-controls button {
  height: 54px;
  border: 1px solid #ffffff2b;
  background: #243239;
  color: white;
  font-size: 25px;
  font-weight: 900;
  touch-action: none;
}
.rally-controls .boost {
  font-size: 14px;
  background: #e74343;
}
@media (max-width: 950px) {
  .rally-picker {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .rally-picker > p {
    width: 100%;
    margin: 0;
  }
  .racer-options {
    flex-basis: 100%;
  }
  .rally-start {
    width: 100%;
  }
  .rally-controls {
    display: grid;
  }
}
@media (max-width: 700px) {
  .rally-head {
    display: block;
  }
  .rally-how {
    margin-top: 20px;
  }
  .racer-options {
    grid-template-columns: repeat(2, 1fr);
  }
  .rally-shell {
    margin-left: -4vw;
    margin-right: -4vw;
    padding: 10px;
  }
  .rally-hud span {
    padding: 5px 7px;
  }
  .rally-hud b {
    font-size: 15px;
  }
  .boost-meter {
    top: 76px;
  }
  .boost-meter i {
    width: 90px;
  }
  .rally-result h3 {
    font-size: 36px;
  }
}

/* Longer race setup */
.rally-picker {
  flex-wrap: wrap;
}
.rally-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}
.rally-name input {
  width: 180px;
  border: 1px solid #ffffff35;
  background: #fff;
  color: #172126;
  padding: 10px 12px;
}
.rally-start-status {
  width: 100%;
  margin: 0 !important;
  color: #ffd34e;
  font-size: 13px;
}
.rally-start-status:empty {
  display: none;
}
.rally-search{display:grid;grid-template-columns:auto minmax(150px,1fr) auto;align-items:center;gap:8px;flex:1;min-width:320px}.rally-search label{font-size:13px;font-weight:800}.rally-search input{padding:10px 12px;border:1px solid #ffffff35;border-radius:6px}.rally-search button{padding:10px 14px;border:0;border-radius:6px;background:#f5cc43;font-weight:900}.rally-search span{grid-column:2/-1;min-height:16px;color:#bfe7ff;font-size:12px}.rally-difficulty{display:flex;align-items:center;gap:14px;border:1px solid #ffffff2b;border-radius:8px;padding:8px 12px}.rally-difficulty legend{padding:0 6px;font-size:12px;font-weight:900}.rally-difficulty label{font-size:13px}.rally-cinematic{position:absolute;inset:0;z-index:5;place-content:center;text-align:center;background:radial-gradient(circle at 50% 35%,#315c9b,#11192b 70%);color:#fff;overflow:hidden}.rally-cinematic:not([hidden]){display:grid}.rally-cinematic h3{font:clamp(30px,5vw,54px) Georgia,serif;margin:4px 0 22px}.cinema-kicker{letter-spacing:.2em;font-weight:900}.podium{display:flex;align-items:flex-end;justify-content:center;gap:8px;min-height:250px}.podium-place{position:relative;display:grid;justify-items:center;width:26%;max-width:190px;opacity:0;transform:translateY(120px)}.podium-place img{width:clamp(65px,11vw,120px);height:clamp(65px,11vw,120px);object-fit:contain;filter:drop-shadow(0 10px 7px #0006)}.podium-place b,.podium-place small{display:block}.podium-place i{display:grid;place-items:center;width:100%;margin-top:8px;background:linear-gradient(#f7d96a,#ad791f);color:#172238;font:900 34px Georgia,serif;height:75px}.place-2 i{height:55px;background:linear-gradient(#e7edf3,#8996a5)}.place-3 i{height:42px;background:linear-gradient(#dda06b,#8d5431)}.play .place-1{animation:podiumIn .65s .9s forwards}.play .place-2{animation:podiumIn .65s 1.5s forwards}.play .place-3{animation:podiumIn .65s 2.1s forwards}.cinema-confetti{position:absolute;inset:8% 0 auto;font-size:28px;word-spacing:28px;color:#ffd84d;opacity:0}.play .cinema-confetti{animation:confetti 2s 2.4s forwards}@keyframes podiumIn{to{opacity:1;transform:translateY(0)}}@keyframes confetti{0%{opacity:0;transform:translateY(-60px)}30%{opacity:1}100%{opacity:0;transform:translateY(240px) rotate(15deg)}}@media(max-width:700px){.rally-search{min-width:100%;grid-template-columns:1fr auto}.rally-search label{grid-column:1/-1}.rally-search span{grid-column:1/-1}.rally-difficulty{width:100%;justify-content:center}.podium-place{width:30%}}

/* Pokémon Cart dimensional race surface and battle items */
.rally-shell {
  background: linear-gradient(145deg, #253943, #0c1418 68%);
  border: 1px solid #ffffff24;
  border-radius: 24px;
  box-shadow:
    0 30px 75px #0005,
    inset 0 1px #ffffff30;
  perspective: 1100px;
}
.rally-stage {
  border-radius: 14px;
  border: 3px solid #ffffff30;
  box-shadow: 0 18px 42px #0008;
  transform: rotateX(1deg);
  transform-origin: center bottom;
}
.item-slot {
  position: absolute;
  right: 16px;
  top: 54px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 3px 8px;
  min-width: 150px;
  padding: 8px 10px;
  border: 2px solid #ffffff88;
  border-radius: 10px;
  background: linear-gradient(135deg, #18262edd, #0d1318dd);
  color: #aeb9bd;
  box-shadow: 0 8px 24px #0007;
}
.item-slot > span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.item-slot b {
  color: white;
  font-size: 13px;
  text-align: right;
}
.item-slot small {
  grid-column: 1/-1;
  text-align: right;
  font-size: 10px;
}
.item-slot.ready {
  border-color: #ffe14d;
  animation: itemReady 0.75s ease-in-out infinite alternate;
}
.item-slot.ready b {
  color: #ffe14d;
}
.item-message {
  position: absolute;
  left: 50%;
  top: 74px;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: #111d;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  text-shadow: 0 2px 4px #000;
  white-space: nowrap;
}
.item-message:empty {
  display: none;
}
@keyframes itemReady {
  to {
    box-shadow: 0 0 22px #ffe14d99;
  }
}
.rally-controls {
  grid-template-columns: 1fr 1.15fr 1.15fr 1fr;
}
.rally-controls .item {
  font-size: 13px;
  background: #7048df;
}
.rally-controls .item:disabled {
  opacity: 0.45;
}
@media (max-width: 700px) {
  .item-slot {
    top: 62px;
    right: 8px;
    min-width: 128px;
  }
  .item-message {
    top: 116px;
    max-width: 90%;
    white-space: normal;
    text-align: center;
    font-size: 12px;
  }
}
