.scroll-rail {
  position: fixed;
  top: 55%;
  right: max(8px, calc(env(safe-area-inset-right) + 8px));
  z-index: 1450;
  display: grid;
  gap: 6px;
  width: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease;
}

.scroll-rail::before {
  content: "";
  position: absolute;
  top: -9px;
  right: 1px;
  bottom: -9px;
  width: 1px;
  border-radius: 999px;
  background: rgba(145, 145, 145, .28);
}

.scroll-rail.is-visible {
  opacity: .74 !important;
}

.scroll-rail__bar {
  position: relative;
  z-index: 1;
  width: 19px;
  height: 2px;
  margin-right: 10px;
  justify-self: end;
  border-radius: 999px;
  background: rgba(126, 126, 126, .56);
  box-shadow: none;
  transform-origin: right center;
  transition: background .16s ease, opacity .16s ease, transform .16s ease;
  opacity: .62;
}

.scroll-rail__bar.is-lit {
  background: rgba(210, 210, 210, .78);
  opacity: .82;
}

.scroll-rail__bar.is-head {
  height: 2px;
  background: rgba(244, 244, 244, .94);
  box-shadow: none;
  opacity: .9;
  transform: translateX(-1px);
}

@media (max-width: 740px) {
  .scroll-rail {
    top: 55%;
    right: max(5px, calc(env(safe-area-inset-right) + 5px));
    gap: 5px;
    width: 26px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .scroll-rail::before {
    top: -7px;
    right: 1px;
    bottom: -7px;
    background: rgba(145, 145, 145, .24);
  }

  .scroll-rail__bar {
    width: 14px;
    height: 2px;
    margin-right: 8px;
    background: rgba(126, 126, 126, .52);
  }

  .scroll-rail__bar.is-head {
    height: 2px;
    transform: translateX(-1px);
  }

  body.mobile-menu-open .scroll-rail {
    opacity: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-rail,
  .scroll-rail__bar {
    transition: none;
  }
}

@media print {
  .scroll-rail {
    display: none;
  }
}
