.pwa-connectivity,
.pwa-update {
  position: fixed;
  z-index: 1200;
  left: 50%;
  width: min(560px, calc(100% - 24px));
  transform: translateX(-50%);
  border: 1px solid #ffffff30;
  border-radius: 18px;
  background: #18133ee8;
  color: #fff;
  box-shadow: 0 18px 60px #08051f70;
  backdrop-filter: blur(14px);
}
.pwa-connectivity {
  top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  font-size: 13px;
}
.pwa-connectivity b {
  color: #ffd56b;
  white-space: nowrap;
}
.pwa-connectivity span {
  color: #dedaff;
}
.pwa-update {
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  padding: 14px 16px;
}
.pwa-update-copy {
  min-width: 0;
}
.pwa-update-copy b {
  display: block;
  font-size: 13px;
  letter-spacing: 0.08em;
}
.pwa-update-copy span {
  display: block;
  margin-top: 3px;
  color: #c9c4ef;
  font-size: 12px;
  line-height: 1.35;
}
.pwa-update .button {
  margin: 0;
  min-height: 42px;
  padding: 10px 14px;
  white-space: nowrap;
}
.pwa-update .button:disabled {
  opacity: 0.75;
}
#installApp {
  white-space: nowrap;
}

/* Mobile Landscape Experience ------------------------------------------------ */
.rotate-device,
.mobile-game-mode {
  position: fixed;
  z-index: 2600;
  inset: 0;
  padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom))
    calc(20px + var(--safe-left));
}
.rotate-device {
  display: grid;
  place-items: center;
  overflow: auto;
  color: #fff;
  background:
    radial-gradient(circle at 20% 18%, #7258e580 0 18%, transparent 42%),
    radial-gradient(circle at 80% 82%, #28d8e84d 0 15%, transparent 38%),
    linear-gradient(145deg, #171039 0%, #2a1766 52%, #171039 100%);
}
.rotate-device-card {
  width: min(430px, 100%);
  text-align: center;
}
.rotate-device-card h2,
.mobile-game-mode-card h2 {
  margin: 10px 0 8px;
  color: #fff;
  font-size: clamp(24px, 7vw, 40px);
  line-height: 0.95;
  letter-spacing: -0.035em;
}
.rotate-device-card p,
.mobile-game-mode-card p {
  margin: 0 auto 14px;
  max-width: 42ch;
  color: #d8d2ff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}
.rotate-wobbler {
  position: relative;
  width: 58px;
  height: 68px;
  margin: 0 auto 8px;
  border-radius: 45% 45% 42% 42%;
  background: linear-gradient(145deg, #ff6aa9, #ea397f);
  box-shadow: 0 12px 30px #0b062b75;
}
.rotate-wobbler::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 36px;
  height: 21px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #dcfbff;
  box-shadow: inset 0 -5px #9eeaf3;
}
.rotate-wobbler::after {
  content: '';
  position: absolute;
  right: 9px;
  bottom: -11px;
  width: 10px;
  height: 20px;
  border-radius: 8px;
  background: #ea397f;
  box-shadow: -24px 0 #ea397f;
}
.rotate-phone {
  position: relative;
  width: 48px;
  height: 78px;
  margin: 8px auto 18px;
  border: 4px solid #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px #07041e66;
  animation: wobble-rotate-phone 1.5s cubic-bezier(0.2, 0.8, 0.3, 1) infinite;
}
.rotate-phone::before {
  content: '↻';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffdd4c;
  font-size: 30px;
  font-weight: 900;
}
.rotate-phone i {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 15px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: #ffffff9c;
}
.rotate-device .text-button {
  display: inline-block;
  margin: 4px 0 0;
  color: #cfc7ff;
}
.rotate-fallback {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #ffffff26;
  border-radius: 15px;
  background: #ffffff0d;
}
.rotate-fallback .button {
  width: 100%;
  margin: 0;
}

/* Soft fullscreen suggestion: it never owns the whole viewport and cannot trap the player. */
.mobile-game-mode {
  z-index: 2500;
  inset: auto auto calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left));
  width: min(300px, 32vw);
  padding: 0;
  pointer-events: none;
}
.mobile-game-mode-card {
  width: 100%;
  padding: 12px;
  border-radius: 17px;
  text-align: center;
  pointer-events: auto;
}
.mobile-game-mode-card .eyebrow {
  font-size: 8px;
}
.mobile-game-mode-card h2 {
  margin: 5px 0;
  font-size: clamp(15px, 2.2vw, 22px);
}
.mobile-game-mode-card p {
  margin-bottom: 7px;
  font-size: 10px;
  line-height: 1.3;
}
.mobile-game-mode-card .button {
  width: 100%;
  min-height: 34px;
  margin-top: 5px;
  padding: 7px 8px;
  font-size: 10px;
}
.fullscreen-toggle {
  min-width: 42px !important;
  width: 42px;
  padding-inline: 0 !important;
  font-size: 17px;
}

/* Landscape shell: use width for the scene and keep permanent controls at the edges. */
body.mobile-landscape .screen {
  padding-top: calc(10px + var(--safe-top));
  padding-right: calc(12px + var(--safe-right));
  padding-bottom: calc(10px + var(--safe-bottom));
  padding-left: calc(12px + var(--safe-left));
}
body.mobile-landscape .screen-menu {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 48vw, 472px);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 2.5vw, 28px);
}
body.mobile-landscape .brand {
  width: min(39vw, 330px);
}
body.mobile-landscape .brand h1 {
  margin-block: 4px;
  font-size: clamp(38px, 7vw, 68px);
}
body.mobile-landscape .brand p {
  margin-top: 8px;
  font-size: 12px;
}
body.mobile-landscape.menu-polish .menu-card {
  width: 100%;
  max-width: 472px;
  justify-self: end;
  max-height: calc(100vh - 18px - var(--safe-top) - var(--safe-bottom));
  padding: 12px;
  border-radius: 19px;
}
body.mobile-landscape.menu-polish .mode-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 9px;
}
body.mobile-landscape.menu-polish .mode-panel {
  gap: 8px;
}
body.mobile-landscape.menu-polish #raceFind,
body.mobile-landscape.menu-polish #coopFind {
  min-height: 50px;
  padding-block: 10px;
  font-size: 15px;
}
body.mobile-landscape.menu-polish .menu-footer {
  margin-top: 8px;
}

/* Compact race/co-op HUD. On common 375–412 px landscape heights it stays around 48–54 px. */
body.mobile-landscape #hud.hud {
  top: calc(7px + var(--safe-top));
  right: calc(9px + var(--safe-right));
  left: calc(9px + var(--safe-left));
  width: auto;
  min-height: 48px;
  gap: 6px;
  transform: none;
  grid-template-columns: auto auto minmax(120px, 1fr) auto auto;
  align-items: stretch;
}
body.mobile-landscape #hud .hud-leave,
body.mobile-landscape #hud .hud-card,
body.mobile-landscape #hud .hud-progress {
  min-height: 46px;
  border-radius: 13px;
}
body.mobile-landscape #hud .hud-leave {
  min-width: 54px;
  padding: 7px 9px;
  font-size: 9px;
}
body.mobile-landscape #hud .hud-card {
  min-width: 68px;
  padding: 6px 9px;
}
body.mobile-landscape #hud .hud-card small {
  font-size: 7px;
}
body.mobile-landscape #hud .hud-card strong {
  font-size: 14px;
}
body.mobile-landscape #hud .hud-progress {
  min-width: 0;
  padding: 6px 10px;
}
body.mobile-landscape #hud .hud-progress-label {
  gap: 8px;
  font-size: 8px;
}
body.mobile-landscape #hud .progress-track {
  margin-top: 5px;
}

body.mobile-landscape {
  --action-size: 82px;
  --dive-size: 64px;
}
body.mobile-landscape[data-hand='left'] #stick,
body.mobile-landscape[data-hand='left'] #stickZone {
  left: calc(16px + var(--safe-left));
}
body.mobile-landscape[data-hand='right'] #stick,
body.mobile-landscape[data-hand='right'] #stickZone {
  right: calc(16px + var(--safe-right));
}
body.mobile-landscape[data-hand='left'] #jump,
body.mobile-landscape[data-hand='left'] #recenter,
body.mobile-landscape[data-hand='left'] #cameraMode,
body.mobile-landscape[data-hand='left'] #emoteButton {
  right: calc(16px + var(--safe-right));
}
body.mobile-landscape[data-hand='left'] #dive {
  right: calc(28px + var(--safe-right) + var(--action-size) * var(--ui-scale));
}
body.mobile-landscape[data-hand='right'] #jump,
body.mobile-landscape[data-hand='right'] #recenter,
body.mobile-landscape[data-hand='right'] #cameraMode,
body.mobile-landscape[data-hand='right'] #emoteButton {
  left: calc(16px + var(--safe-left));
  right: auto;
}
body.mobile-landscape[data-hand='right'] #dive {
  left: calc(28px + var(--safe-left) + var(--action-size) * var(--ui-scale));
  right: auto;
}
body.mobile-landscape #stick,
body.mobile-landscape #jump {
  bottom: calc(14px + var(--safe-bottom));
}
body.mobile-landscape #dive {
  bottom: calc(18px + var(--safe-bottom));
}

/* Accessibility portrait fallback: playable, intentionally simplified and with larger controls. */
body.portrait-accessibility {
  --action-size: 104px;
  --dive-size: 84px;
}
body.portrait-accessibility #hud.hud {
  right: calc(8px + var(--safe-right));
  left: calc(8px + var(--safe-left));
  width: auto;
  transform: none;
}
body.portrait-accessibility .brand {
  display: none;
}
body.portrait-accessibility .screen-menu {
  align-items: center;
  justify-content: center;
}
body.portrait-accessibility.menu-polish .menu-card {
  width: min(94vw, 480px);
}

@keyframes wobble-rotate-phone {
  0%,
  18% {
    transform: rotate(0deg) scale(1);
  }
  58%,
  82% {
    transform: rotate(90deg) scale(0.96);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

/* Short landscape is a parallel composition, not a vertically scrolling desktop form. */
@media (max-height: 600px) and (orientation: landscape) {
  body.mobile-landscape .brand-kicker,
  body.mobile-landscape .brand p {
    display: none;
  }
  body.mobile-landscape.menu-polish .menu-card {
    padding: 8px;
  }
  body.mobile-landscape.menu-polish .account-bar {
    gap: 4px;
    margin-bottom: 3px;
  }
  body.mobile-landscape.menu-polish .account-chip,
  body.mobile-landscape.menu-polish .profile-chip {
    min-height: 36px;
    padding: 4px 7px;
  }
  body.mobile-landscape.menu-polish .account-chip small,
  body.mobile-landscape.menu-polish .profile-chip small {
    display: none;
  }
  body.mobile-landscape.menu-polish .mode-tabs {
    margin-bottom: 4px;
    padding: 2px;
    border-radius: 11px;
  }
  body.mobile-landscape.menu-polish .mode-tab {
    min-height: 36px;
    padding: 4px 3px;
    font-size: 9px;
  }
  body.mobile-landscape.menu-polish .mode-panel {
    gap: 4px;
  }
  body.mobile-landscape.menu-polish .field-grid {
    gap: 5px;
  }
  body.mobile-landscape.menu-polish .field {
    gap: 2px;
  }
  body.mobile-landscape.menu-polish .field span {
    font-size: 7px;
  }
  body.mobile-landscape.menu-polish .field select,
  body.mobile-landscape.menu-polish .field input,
  body.mobile-landscape.menu-polish .join-row input {
    min-height: 36px;
    padding: 6px 9px;
    font-size: 11px;
  }
  body.mobile-landscape.menu-polish .run-summary {
    min-height: 12px;
    padding: 0 2px;
    font-size: 8px;
  }
  body.mobile-landscape.menu-polish .challenge-rule {
    min-height: 28px;
    margin: 0;
    padding: 4px 7px;
    gap: 7px;
    font-size: 8px;
  }
  body.mobile-landscape.menu-polish .challenge-rule strong {
    font-size: 8px;
  }
  body.mobile-landscape.menu-polish .challenge-rule span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.mobile-landscape.menu-polish #single .button-primary,
  body.mobile-landscape.menu-polish #raceFind,
  body.mobile-landscape.menu-polish #coopFind {
    min-height: 44px;
    padding: 8px 11px;
    font-size: 14px;
  }
  body.mobile-landscape.menu-polish .menu-disclosure {
    min-height: 32px;
    font-size: 8px;
  }
  body.mobile-landscape.menu-polish .menu-footer {
    gap: 4px;
    margin-top: 3px;
  }
  body.mobile-landscape.menu-polish .menu-footer .icon-button {
    min-height: 34px;
    padding: 5px 8px;
  }
  body.mobile-landscape.menu-polish .legal-links {
    margin-top: 2px;
  }
  body.mobile-landscape.menu-polish .legal-links a {
    padding: 2px 4px;
    font-size: 7px;
  }

  body.mobile-landscape.menu-polish #coop .coop-lead,
  body.mobile-landscape.menu-polish #coop .campaign-heading {
    display: none;
  }
  body.mobile-landscape.menu-polish #coop .coop-campaign {
    gap: 3px;
    margin: 0;
  }
  body.mobile-landscape.menu-polish #coop .campaign-grid {
    display: flex;
    gap: 4px;
    padding-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  body.mobile-landscape.menu-polish #coop .campaign-grid::-webkit-scrollbar {
    display: none;
  }
  body.mobile-landscape.menu-polish #coop .campaign-card {
    flex: 0 0 100px;
    height: 46px;
    min-height: 46px;
    padding: 4px 5px;
    gap: 1px 4px;
    align-content: center;
  }
  body.mobile-landscape.menu-polish #coop .campaign-card.selected {
    flex-basis: 142px;
    height: 46px;
    grid-column: auto;
    padding: 4px 5px;
  }
  body.mobile-landscape.menu-polish #coop .campaign-number {
    font-size: 0.82rem;
  }
  body.mobile-landscape.menu-polish #coop .campaign-card.selected .campaign-copy b {
    font-size: 0.62rem;
  }
  body.mobile-landscape.menu-polish #coop .campaign-card.selected .campaign-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.mobile-landscape.menu-polish #coop .campaign-medal,
  body.mobile-landscape.menu-polish #coop .campaign-preview,
  body.mobile-landscape.menu-polish #coop .campaign-stats {
    display: none !important;
  }
  body.mobile-landscape.menu-polish #coop .coop-hint {
    max-height: 18px;
    margin: 0;
    padding: 2px 5px;
    overflow: hidden;
    font-size: 8px;
    line-height: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.mobile-landscape.menu-polish #coop .toggle-row {
    min-height: 24px;
    padding-block: 0;
    font-size: 8px;
  }
  body.mobile-landscape.menu-polish #coopFriendsToggle {
    min-height: 26px;
    margin-top: -2px;
    padding-block: 2px;
    line-height: 1.1;
  }
  body.mobile-landscape.menu-polish #coopStatus {
    min-height: 0;
    max-height: 14px;
    margin: 0;
    padding: 0 2px;
    overflow: hidden;
    font-size: 7px;
    line-height: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.mobile-landscape #hud.hud {
    top: calc(5px + var(--safe-top));
  }
}

@media (max-height: 370px) and (orientation: landscape) {
  body.mobile-landscape.menu-polish #coop .coop-hint {
    display: none;
  }
}

@media (max-width: 720px) and (orientation: landscape) {
  body.mobile-landscape .brand {
    width: 30vw;
  }
  body.mobile-landscape .brand h1 {
    font-size: clamp(34px, 7vw, 50px);
  }
  body.mobile-landscape.menu-polish .menu-card {
    width: 100%;
  }
  body.mobile-landscape #hud.hud {
    grid-template-columns: auto auto minmax(90px, 1fr) auto;
  }
  body.mobile-landscape #pingBox {
    display: none !important;
  }
  body.mobile-landscape #stageName {
    max-width: 18vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rotate-phone {
    animation: none;
    transform: rotate(90deg);
  }
}
body.reduced-motion .rotate-phone,
body.mobile-reduced-motion .rotate-phone {
  animation: none;
  transform: rotate(90deg);
}

@media (max-width: 600px) {
  .pwa-update {
    grid-template-columns: 1fr;
  }
  .pwa-update .button {
    width: 100%;
  }
  .pwa-connectivity {
    align-items: flex-start;
  }
}
@media (display-mode: standalone) {
  #installApp {
    display: none !important;
  }
}

/* Race presentation ---------------------------------------------------------- */
#countdown.countdown {
  background:
    radial-gradient(circle at 50% 47%, #ffdd4c24 0 17%, transparent 43%),
    radial-gradient(circle at 50% 50%, #4ce0df18 0 33%, transparent 62%), #25165f24;
  backdrop-filter: saturate(1.08);
}
#countdown.countdown span {
  position: relative;
  display: grid;
  min-width: min(70vw, 420px);
  min-height: min(46vw, 250px);
  padding: 26px 34px 30px;
  place-items: center;
  border: 3px solid #ffffffc9;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(145deg, #6d50dcf2, #43239bdd);
  box-shadow:
    0 12px 0 #38207b,
    0 26px 70px #2812657a,
    inset 0 4px #ffffff4f;
  font-size: clamp(48px, 14vw, 150px);
  line-height: 0.86;
  letter-spacing: -0.055em;
  text-align: center;
  text-shadow:
    0 7px 0 #4d31af,
    0 14px 30px #24125080;
  animation: race-count-pop 0.48s cubic-bezier(0.17, 0.9, 0.35, 1.35);
}
#countdown.countdown span::before,
#countdown.countdown span::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
#countdown.countdown span::before {
  inset: -19px;
  border: 4px solid #ffdd4c96;
  border-radius: inherit;
  box-shadow: 0 0 36px #ffdd4c5c;
  animation: race-count-ring 0.48s ease-out both;
}
#countdown.countdown span::after {
  width: 52%;
  height: 10px;
  bottom: 18px;
  border-radius: 99px;
  background: linear-gradient(90deg, #4ce0df, #ffdd4c, #ff4f92);
  box-shadow: 0 0 24px #4ce0df6b;
}

.checkpoint-banner {
  min-width: min(360px, calc(100vw - 32px));
  padding: 13px 56px 13px 18px;
  overflow: hidden;
  border: 2px solid #ffffffc7;
  border-radius: 18px;
  background:
    linear-gradient(90deg, #4ce0df22, transparent 45%), linear-gradient(145deg, #382182f2, #25145eea);
  box-shadow:
    0 11px 0 #21104f47,
    0 22px 44px #26165d66,
    inset 0 2px #ffffff30;
  pointer-events: none;
  text-align: left;
  animation: race-checkpoint-pop 0.9s cubic-bezier(0.2, 0.85, 0.25, 1) both;
}
.checkpoint-banner::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(var(--world-accent, #4ce0df), var(--world-secondary, #ffdd4c));
  box-shadow: 0 0 22px var(--world-glow, #4ce0df9a);
}
.checkpoint-banner::after {
  content: '✓';
  position: absolute;
  top: 50%;
  right: 17px;
  display: grid;
  width: 30px;
  height: 30px;
  transform: translateY(-50%) rotate(-5deg);
  place-items: center;
  border-radius: 50%;
  color: #28165f;
  background: var(--world-secondary, var(--yellow));
  box-shadow: 0 4px 0 #c98623;
  font-size: 18px;
  font-weight: 950;
}
.checkpoint-banner small {
  display: block;
  margin-bottom: 2px;
  color: #91fff0;
  font-size: 9px;
  letter-spacing: 0.19em;
}
.checkpoint-banner strong {
  color: #fff;
  font-size: 25px;
  letter-spacing: 0.02em;
  text-shadow: 0 3px #332078;
}

#hud .hud-progress {
  border-color: #ffffff6b;
  background:
    linear-gradient(180deg, #ffffff0e, transparent 52%), linear-gradient(145deg, #352078e8, #221452e8);
  box-shadow:
    0 8px 22px #1e104752,
    inset 0 1px #ffffff25;
}
#hud .hud-progress-label {
  color: #d9d6f5;
}
#hud #stageName {
  color: #fff;
  text-shadow: 0 2px 9px #160c3d;
}
#hud .progress-track {
  height: 9px;
  overflow: hidden;
  border: 1px solid #ffffff24;
  background: #160d43b8;
  box-shadow: inset 0 2px 6px #0e092d8c;
}
#progressFill {
  position: relative;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ce0df 0 55%, #ffdd4c 78%, #ff9c4a 100%);
  box-shadow:
    0 0 12px #4ce0df8c,
    inset 0 2px #ffffff75;
}
#progressFill::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(105deg, transparent 25%, #ffffff70 48%, transparent 70%);
  animation: race-progress-shine 2.7s ease-in-out infinite;
}

#finish .finish-card {
  border-color: #fff1ad;
  background:
    radial-gradient(circle at 50% 0, #ffdd4c24 0 20%, transparent 48%),
    linear-gradient(145deg, #4c2ca4f7, #241356f7);
  box-shadow:
    0 24px 80px #1d0d506e,
    0 0 0 5px #ffffff0d,
    inset 0 2px #ffffff42;
}
#finish .finish-card::before {
  content: '';
  position: absolute;
  z-index: 0;
  top: 0;
  left: 9%;
  width: 82%;
  height: 7px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, #4ce0df, #ffdd4c 48%, #ff4f92);
  box-shadow: 0 0 22px #ffdd4c5e;
}
#finish .finish-card > * {
  position: relative;
  z-index: 1;
}
#finish .finish-card .eyebrow,
#finishEyebrow {
  color: #a6fff1;
}
#finish .finish-card h2 {
  letter-spacing: -0.035em;
  text-shadow:
    0 5px #3b2388,
    0 12px 24px #1c0d4c69;
}
#finish .medal {
  filter: drop-shadow(0 12px 18px #170a477a);
  animation: race-medal-arrive 0.72s cubic-bezier(0.16, 0.9, 0.25, 1.25);
}

@keyframes race-count-pop {
  from {
    opacity: 0;
    transform: scale(0.72) rotate(-4deg);
  }
  68% {
    opacity: 1;
    transform: scale(1.06) rotate(1deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}
@keyframes race-count-ring {
  from {
    opacity: 0;
    transform: scale(0.76);
  }
  to {
    opacity: 1;
    transform: scale(1.04);
  }
}
@keyframes race-checkpoint-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(0.78) rotate(-2deg);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04) rotate(0.5deg);
  }
  76% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.98);
  }
}
@keyframes race-progress-shine {
  0%,
  58% {
    transform: translateX(-120%);
  }
  82%,
  100% {
    transform: translateX(120%);
  }
}
@keyframes race-medal-arrive {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.62) rotate(-10deg);
  }
  72% {
    opacity: 1;
    transform: translateY(2px) scale(1.08) rotate(2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@media (max-width: 600px) {
  #countdown.countdown span {
    min-width: min(82vw, 360px);
    min-height: 150px;
    padding: 20px 24px 24px;
    font-size: clamp(44px, 13vw, 90px);
  }
  .checkpoint-banner {
    top: 22%;
    min-width: min(330px, calc(100vw - 24px));
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  #countdown.countdown span {
    min-width: min(46vw, 340px);
    min-height: min(42vh, 180px);
    padding: 15px 24px 19px;
    font-size: clamp(42px, 12vh, 78px);
  }
  .checkpoint-banner {
    top: 31%;
    min-width: min(310px, 48vw);
    padding-block: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #countdown.countdown span,
  #countdown.countdown span::before,
  .checkpoint-banner,
  #progressFill::after,
  #finish .medal {
    animation: none;
  }
}
body.reduced-motion #countdown.countdown span,
body.reduced-motion #countdown.countdown span::before,
body.reduced-motion .checkpoint-banner,
body.reduced-motion #progressFill::after,
body.reduced-motion #finish .medal,
body.mobile-reduced-motion #countdown.countdown span,
body.mobile-reduced-motion #countdown.countdown span::before,
body.mobile-reduced-motion .checkpoint-banner,
body.mobile-reduced-motion #progressFill::after,
body.mobile-reduced-motion #finish .medal {
  animation: none;
}
