/* Original child sprites share one small WebP. Raqi keeps his original image. */
.runner-sprite {
  display: inline-block;
  width: 120px;
  aspect-ratio: 1;
  flex-shrink: 0;
  background-size: 300% 200%;
  background-position: var(--kid-x) 0%;
  background-repeat: no-repeat;
}
.world-race-link {
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 17px 0 0;
  border: 1.5px solid #d5b972;
  border-radius: 22px 14px 20px 12px;
  background: #fff3ce;
  box-shadow: 0 4px #c6a86b66;
  color: #3d6347;
  text-align: left;
}
.world-race-friends {
  display: flex;
  padding-left: 5px;
}
.world-race-friends .runner-sprite {
  width: 66px;
  margin-right: -20px;
}
.world-race-friends .runner-sprite:last-child {
  margin-right: 0;
}
.world-race-link small {
  display: block;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 1px;
}
.world-race-link strong {
  display: flex;
  align-items: center;
  font:
    800 21px/1.2 "Fredoka",
    cursive;
}
.world-race-link .world-icon {
  width: 19px;
  height: 19px;
  margin-left: 5px;
}
.activity-race .activity-art > .runner-sprite {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  z-index: 1;
}
.race-ready,
.race-result,
.race-play {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
}
.race-ready {
  display: flex;
  flex-direction: column;
}
.race-heading {
  text-align: center;
  flex-shrink: 0;
}
.race-heading h1,
.race-result h1 {
  font:
    800 clamp(26px, 4vw, 48px) / 1.1 "Fredoka",
    cursive;
  color: #365d42;
  margin: 7px 0;
}
.race-heading p,
.race-result > p {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}
.runner-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  flex: 1;
  min-height: 0;
  margin: 22px auto;
  width: min(850px, 100%);
}
.runner-choice {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  min-height: 0;
  border: 2px solid #e1d8b5;
  border-bottom-width: 6px;
  border-radius: 45% 45% 22px 22px;
  padding: 10px;
  background:
    linear-gradient(transparent 0 18%, var(--friend-color) 100%), #fff8dfb8;
  color: #365d42;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.runner-choice:hover {
  transform: translateY(-4px);
}
.runner-choice.selected {
  border-color: #5b8964;
  background-color: #fff9e7;
}
.runner-choice .runner-sprite {
  width: min(100%, 24vh, 240px);
  flex: 0 1 auto;
  min-height: 0;
  aspect-ratio: 1;
}
.runner-choice strong {
  font:
    800 27px/1.2 "Fredoka",
    cursive;
}
.runner-choice small {
  font-size: 11px;
  font-weight: 900;
}
.race-ready-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
}
.race-ready-footer > div {
  text-align: center;
}
.race-ready-footer > div > small {
  display: block;
  font-size: 9px;
  margin-top: 7px;
}
.race-ready-footer .btn {
  min-width: 230px;
}
.race-coach {
  display: flex;
  align-items: center;
  gap: 8px;
}
.race-coach img {
  height: 100px;
  width: auto;
}
.race-coach p {
  background: #fff9e8;
  padding: 12px 16px;
  border: 1.5px solid #c8c69b;
  border-radius: 19px 19px 19px 0;
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.6;
}
.race-play {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.race-scoreboard {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  font-weight: 900;
  flex-shrink: 0;
}
.race-scoreboard > span {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.race-scoreboard .world-icon {
  width: 23px;
  height: 23px;
}
.race-scoreboard progress {
  flex: 1;
  min-width: 0;
  height: 10px;
}
.race-scoreboard .mini-action {
  min-height: 36px;
}
.race-scene {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #deedc2;
  border: 3px solid #fbf4dc;
  border-bottom: 7px solid #9ab578;
  border-radius: 26px;
  touch-action: none;
  cursor: pointer;
  isolation: isolate;
}
.race-scenery {
  position: absolute;
  inset: 0 0 30%;
  background:
    linear-gradient(#ddf1de22, #c8dda3 90%),
    url("../../assets/images/play-world.webp") center 40% / cover;
  z-index: -1;
}
.race-lanes {
  position: absolute;
  inset: 14% 0 0;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
}
.race-lane {
  position: relative;
  min-height: 0;
  border-top: 2px dashed #fff4d199;
  background: linear-gradient(#e5bb8277, #d5ac77aa);
}
.race-lane.your-lane {
  background: linear-gradient(#f3d69a99, #e0bd87cc);
}
.race-lane-label {
  position: absolute;
  top: 5px;
  left: 10px;
  font-size: 10px;
  font-weight: 900;
  color: #5b6942;
}
.race-runner {
  position: absolute;
  left: var(--distance);
  bottom: 5%;
  width: clamp(65px, 9vw, 112px);
  max-height: 100%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  transition: left 0.1s linear;
  z-index: 3;
  pointer-events: none;
}
.runner-body {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  transition: transform 0.17s ease;
}
.race-runner .runner-sprite {
  width: 100%;
  height: 100%;
  animation: race-stride 0.19s steps(1, end) infinite alternate;
}
.race-runner:nth-child(even) .runner-sprite {
  animation-delay: -0.1s;
}
.race-runner.is-jumping .runner-body {
  transform: translateY(-50%) rotate(-8deg);
}
.runner-shadow {
  position: absolute;
  width: 40%;
  height: 8%;
  border-radius: 50%;
  background: #79694833;
  bottom: -2%;
  left: 30%;
}
.is-jumping .runner-shadow {
  transform: scale(0.7);
  opacity: 0.5;
}
.race-gate {
  position: absolute;
  transform: translateX(-50%);
  bottom: 12%;
  width: 26px;
  height: 32%;
  min-height: 17px;
  z-index: 2;
}
.race-gate > i {
  position: absolute;
  inset: 0;
  border: 3px solid #a57d4c;
  border-top: 7px solid #f6ead0;
  border-bottom: 0;
  box-shadow: 0 -2px #9d805d;
}
.race-gate > span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: #fff4ca;
  color: #4c6c41;
  border: 1px solid #cda151;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  text-align: center;
  font:
    26px/35px "Amiri",
    serif;
}
.race-gate.is-collected > span {
  opacity: 0;
  transform: translate(-50%, -25px);
  transition: 0.3s;
}
.race-gate.is-collected > i {
  opacity: 0.4;
}
.race-gate.is-passed {
  opacity: 0.35;
}
.race-finish {
  position: absolute;
  left: 93%;
  top: 8%;
  bottom: 0;
  z-index: 1;
  width: 10px;
  background: conic-gradient(
      #fff3d6 25%,
      #56715a 0 50%,
      #fff3d6 0 75%,
      #56715a 0
    )
    0 0 / 10px 10px;
}
.race-finish > b {
  position: absolute;
  left: -20px;
  top: -13px;
  border-radius: 5px;
  background: #638b5b;
  padding: 4px 6px;
  color: #fff7d9;
  font-size: 9px;
}
.race-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-shrink: 0;
}
.race-help {
  display: flex;
  align-items: center;
  min-width: 0;
}
.race-help img {
  height: 83px;
  width: auto;
}
.race-help strong {
  display: block;
  font-size: 13px;
}
.race-help small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
}
.race-controls .btn {
  min-width: 180px;
  min-height: 54px;
  touch-action: manipulation;
}
.race-controls .jump-now {
  background: #b97e2e;
  box-shadow:
    0 4px #865d2b,
    0 0 0 4px #edcc8177;
}
.race-pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #f6f4e5f5;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}
.race-pause-overlay > span .world-icon {
  width: 58px;
  height: 58px;
}
.race-pause-overlay h2 {
  font:
    800 32px/1.1 "Fredoka",
    cursive;
  margin: 0;
}
.race-pause-overlay p {
  margin: 0;
  font-size: 13px;
}
.is-paused .runner-sprite {
  animation-play-state: paused;
}
.race-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 9px;
}
.race-result h1 {
  margin: 0;
}
.race-result-art {
  position: relative;
  height: min(23vh, 180px);
  aspect-ratio: 1.4;
}
.race-result-art .runner-sprite {
  height: 100%;
  width: auto;
}
.race-result-art > .world-icon {
  position: absolute;
  right: -15px;
  bottom: 0;
  width: 65px;
  height: 65px;
}
.race-letter-collection {
  display: flex;
  gap: 10px;
}
.race-letter {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 20px;
  border: 1.5px dashed #b6bd9a;
  border-radius: 15px;
  color: #4f6747;
  background: #f2edda;
}
.race-letter.collected {
  border: 2px solid #d1b25e;
  background: #fff1c2;
}
.race-letter > strong {
  font:
    40px/1.4 "Amiri",
    serif;
}
.race-letter > small {
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 4px;
}
.race-letter .world-icon {
  width: 16px;
  height: 16px;
}
.race-result .quiet-note {
  font-size: 10px;
}
.race-result-actions {
  display: flex;
  gap: 9px;
}
.race-result .race-coach img {
  height: 72px;
}
.race-result .race-coach p {
  font-size: 10px;
  text-align: left;
}
@keyframes race-stride {
  from {
    background-position-y: 0%;
  }
  to {
    background-position-y: 100%;
  }
}
@media (max-width: 699px) {
  .world-race-link {
    right: 0;
    bottom: 13%;
    padding-right: 9px;
  }
  .world-race-friends .runner-sprite {
    width: 44px;
    margin-right: -19px;
  }
  .world-race-link strong {
    font-size: 14px;
  }
  .world-race-link small {
    font-size: 5px;
  }
  .world-race-link .world-icon {
    width: 13px;
    height: 13px;
  }
  .runner-choices {
    gap: 7px;
    margin: 16px 0;
    flex: 0 1 280px;
  }
  .runner-choice {
    padding: 10px 4px;
    border-bottom-width: 4px;
  }
  .runner-choice .runner-sprite {
    width: 100%;
    flex: 0 1 auto;
    max-height: none;
  }
  .runner-choice strong {
    font-size: 22px;
  }
  .runner-choice small {
    font-size: 8px;
  }
  .race-heading h1 {
    font-size: 30px;
  }
  .race-heading .eyebrow {
    font-size: 7px;
  }
  .race-heading p {
    font-size: 11px;
    padding: 0 12px;
  }
  .race-ready-footer {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
  }
  .race-ready-footer .race-coach img {
    height: 85px;
  }
  .race-ready-footer .race-coach p {
    font-size: 10px;
    padding: 9px 11px;
  }
  .race-ready-footer .btn {
    min-width: 230px;
  }
  .race-scoreboard {
    gap: 9px;
    font-size: 11px;
  }
  .race-scoreboard .world-icon {
    width: 18px;
    height: 18px;
  }
  .race-scoreboard .mini-action {
    font-size: 10px;
    padding: 5px 8px;
  }
  .race-scene {
    border-radius: 18px;
  }
  .race-gate {
    width: 18px;
  }
  .race-gate > span {
    width: 27px;
    height: 30px;
    font-size: 23px;
    line-height: 30px;
  }
  .race-gate > i {
    border-width: 2px;
    border-top-width: 5px;
  }
  .race-finish {
    left: 94%;
  }
  .race-lane-label {
    font-size: 8px;
  }
  .race-help img {
    height: 66px;
  }
  .race-help strong {
    font-size: 11px;
  }
  .race-help small {
    font-size: 8px;
  }
  .race-controls {
    gap: 5px;
  }
  .race-controls .btn {
    min-width: 92px;
    padding: 10px;
    min-height: 50px;
    font-size: 15px;
  }
  .race-controls .btn .world-icon {
    width: 19px;
    height: 19px;
  }
  .race-result-art {
    height: min(21vh, 130px);
  }
  .race-result .race-coach {
    display: none;
  }
  .race-letter {
    padding: 4px 14px;
  }
  .race-letter > strong {
    font-size: 34px;
  }
}
@media (max-height: 699px) {
  .world-race-link {
    display: none;
  }
}
@media (max-height: 699px) and (max-width: 479px) {
  .runner-choices {
    margin: 9px 0;
    flex: 1;
  }
  .runner-choice .runner-sprite {
    width: min(100%, 100px);
  }
  .runner-choice strong {
    font-size: 18px;
  }
  .race-heading h1 {
    font-size: 24px;
    margin: 4px 0;
  }
  .race-heading p {
    font-size: 9px;
  }
  .race-ready-footer {
    flex: 0;
    gap: 6px;
  }
  .race-ready-footer .race-coach {
    display: none;
  }
  .race-ready-footer > div > small {
    font-size: 8px;
    margin-top: 4px;
  }
  .race-ready-footer .btn {
    min-height: 44px;
    padding-top: 9px;
    padding-bottom: 9px;
  }
  .race-result {
    gap: 6px;
  }
  .race-result-art {
    height: 75px;
  }
  .race-result h1 {
    font-size: 25px;
  }
  .race-result > p {
    font-size: 11px;
  }
  .race-letter {
    padding: 2px 10px;
  }
  .race-letter > strong {
    font-size: 28px;
  }
  .race-result-actions .btn {
    padding: 9px 12px;
    min-height: 42px;
    font-size: 13px;
  }
}
@media (max-height: 599px) and (min-width: 480px) {
  .race-heading h1 {
    font-size: 25px;
    margin: 0 0 4px;
  }
  .race-heading .eyebrow {
    display: none;
  }
  .race-heading p {
    font-size: 10px;
  }
  .runner-choices {
    gap: 15px;
    margin: 7px auto;
    width: 70%;
    flex: 1;
  }
  .runner-choice {
    flex-direction: row;
    border-radius: 20px;
    border-bottom-width: 3px;
    padding: 3px;
    flex-wrap: wrap;
  }
  .runner-choice .runner-sprite {
    width: min(35%, 70px);
    flex: 0 0 auto;
    height: auto;
  }
  .runner-choice strong {
    font-size: 19px;
  }
  .runner-choice small {
    display: none;
  }
  .race-ready-footer {
    display: block;
    text-align: center;
  }
  .race-ready-footer .race-coach {
    display: none;
  }
  .race-ready-footer .btn {
    padding: 6px 20px;
    min-height: 38px;
    font-size: 14px;
  }
  .race-ready-footer > div > small {
    font-size: 7px;
    margin-top: 3px;
  }
  .race-play {
    gap: 5px;
  }
  .race-scoreboard {
    font-size: 10px;
    gap: 10px;
  }
  .race-scoreboard .mini-action {
    padding: 3px 7px;
    min-height: 28px;
  }
  .race-scoreboard .world-icon {
    width: 17px;
    height: 17px;
  }
  .race-scene {
    border-radius: 15px;
    border-bottom-width: 4px;
  }
  .race-lanes {
    top: 10%;
  }
  .race-runner {
    width: 57px;
  }
  .race-lane-label {
    font-size: 7px;
    top: 2px;
  }
  .race-gate {
    min-height: 11px;
    width: 19px;
  }
  .race-gate > span {
    height: 21px;
    width: 24px;
    font-size: 18px;
    line-height: 21px;
    bottom: calc(100% + 4px);
  }
  .race-gate > i {
    border-width: 2px;
    border-top-width: 4px;
  }
  .race-controls .btn {
    min-height: 36px;
    padding: 4px 18px;
    font-size: 14px;
    min-width: 150px;
  }
  .race-help img {
    height: 39px;
  }
  .race-help strong {
    font-size: 10px;
  }
  .race-help small {
    font-size: 7px;
    margin-top: 0;
  }
  .race-result {
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr) minmax(max-content, 1.1fr);
    grid-template-rows: 1fr auto auto;
    column-gap: 18px;
    row-gap: 3px;
    text-align: left;
  }
  .race-result-art {
    grid-column: 1;
    grid-row: 1 / 4;
    width: 100%;
    max-width: 182px;
    height: auto;
    justify-self: center;
  }
  .race-result-art > .world-icon {
    width: 45px;
    height: 45px;
    right: 0;
  }
  .race-result > .eyebrow {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 7px;
  }
  .race-result h1 {
    grid-column: 2;
    grid-row: 2;
    font-size: 27px;
  }
  .race-result > p:not(.quiet-note) {
    grid-column: 2;
    grid-row: 3;
    font-size: 10px;
    align-self: start;
  }
  .race-letter-collection {
    grid-column: 3;
    grid-row: 1 / 3;
    gap: 4px;
    align-self: end;
  }
  .race-letter {
    padding: 1px 8px;
  }
  .race-letter > strong {
    font-size: 28px;
  }
  .race-letter > small {
    font-size: 8px;
  }
  .race-letter .world-icon {
    width: 13px;
    height: 13px;
  }
  .race-result-actions {
    grid-column: 3;
    grid-row: 3;
    align-self: start;
    gap: 5px;
  }
  .race-result-actions .btn {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 34px;
  }
  .race-result .quiet-note,
  .race-result .race-coach {
    display: none;
  }
  .race-pause-overlay {
    gap: 5px;
  }
  .race-pause-overlay > span .world-icon {
    height: 30px;
    width: 30px;
  }
  .race-pause-overlay h2 {
    font-size: 24px;
  }
  .race-pause-overlay p {
    font-size: 11px;
  }
  .race-pause-overlay .btn {
    min-height: 36px;
    padding: 6px 16px;
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .race-runner .runner-sprite {
    animation: none;
  }
  .race-runner,
  .runner-body,
  .runner-choice,
  .race-gate > span {
    transition: none !important;
  }
  .runner-choice:hover {
    transform: none;
  }
}
