/* Only the return-to-top control. Wave navigation keeps its own positioning. */
html body > :is(#kmg-backtotop, #art-backtotop, #btn-back-top).kmg-viewport-up,
html body#top > :is(#kmg-backtotop, #art-backtotop, #btn-back-top).kmg-viewport-up {
  position: fixed !important;
  top: auto !important;
  left: auto !important;
  right: calc(30px + env(safe-area-inset-right)) !important;
  bottom: calc(30px + env(safe-area-inset-bottom)) !important;
  margin: 0 !important;
  transform: none !important;
  translate: none !important;
  rotate: none !important;
  scale: none !important;
  animation: none !important;
  transition-property: opacity, box-shadow, background-color, border-color !important;
  z-index: 2147483646 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
html body > :is(#kmg-backtotop, #art-backtotop, #btn-back-top).kmg-viewport-up[data-kmg-up-obscured],
html body#top > :is(#kmg-backtotop, #art-backtotop, #btn-back-top).kmg-viewport-up[data-kmg-up-obscured] {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
@media (max-width: 1023px) {
  html body > :is(#kmg-backtotop, #art-backtotop, #btn-back-top).kmg-viewport-up,
  html body#top > :is(#kmg-backtotop, #art-backtotop, #btn-back-top).kmg-viewport-up {
    right: calc(18px + env(safe-area-inset-right)) !important;
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;
  }
}
/* Pages without a prior floating control use the existing premium identity. */
html body > .kmg-viewport-up.kmg-up-created,
html body > #btn-back-top.kmg-viewport-up {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid #E8CC80;
  background: rgba(45, 44, 41, .9);
  color: #f6f0e3;
  box-shadow: 0 8px 22px rgba(20, 19, 17, .3);
  cursor: pointer;
}
html body > .kmg-up-created svg { width: 22px; height: 22px; pointer-events: none; }
html body > .kmg-viewport-up:focus-visible { outline: 3px solid #E8CC80; outline-offset: 4px; }
/* The existing project lightbox must retain exclusive pointer/keyboard access. */
html.kf-lb-open body#top > #kmg-backtotop.kmg-viewport-up { visibility: hidden !important; }
@media (max-width: 1023px) {
  html body > .kmg-viewport-up.kmg-up-created,
  html body > #btn-back-top.kmg-viewport-up { width: 48px; height: 48px; }
}
@media (max-width: 599px) {
  /* Leave the legal links outside the fixed button's corner at page end. */
  html body > footer :is(.kmg-footer-bottom, .footer-copyright) {
    box-sizing: border-box;
    padding-inline-end: 76px;
  }
}
