@property --elgatec-backtop-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.elgatec-backtop {
  --elgatec-backtop-angle: 0deg;
  --elgatec-backtop-bottom: 24px;
  position: fixed;
  right: 24px;
  bottom: calc(var(--elgatec-backtop-bottom) + env(safe-area-inset-bottom, 0px));
  z-index: 1190;
  width: 58px;
  height: 58px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 19px;
  color: #fff;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 18px, 0) scale(.82);
  isolation: isolate;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .28s ease, visibility .28s ease, transform .34s cubic-bezier(.2,.85,.2,1);
}

.elgatec-backtop::before,
.elgatec-backtop::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
}

.elgatec-backtop::before {
  inset: -2px;
  z-index: -2;
  background: conic-gradient(
    from var(--elgatec-backtop-angle),
    #39e2f2 0deg,
    #0ba9d4 92deg,
    #ffe066 162deg,
    #f5b900 213deg,
    #0b6988 282deg,
    #39e2f2 360deg
  );
  filter: drop-shadow(0 9px 18px rgba(11,169,212,.28));
  animation: elgatec-backtop-orbit 3.6s linear infinite;
}

.elgatec-backtop::after {
  inset: 2px;
  z-index: -1;
  border: 1px solid rgba(255,255,255,.13);
  background:
    radial-gradient(circle at 26% 18%, rgba(57,226,242,.24), transparent 42%),
    linear-gradient(145deg, rgba(10,48,66,.98), rgba(3,20,31,.98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.14),
    inset 0 -13px 22px rgba(1,10,18,.25),
    0 14px 38px rgba(3,20,31,.34);
  backdrop-filter: blur(12px);
}

.elgatec-backtop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0,0,0) scale(1);
}

.elgatec-backtop__core {
  position: absolute;
  inset: 7px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(88,225,244,.32);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(13,73,94,.78), rgba(4,27,40,.42));
  box-shadow: inset 0 0 18px rgba(45,216,239,.08);
  transition: transform .28s cubic-bezier(.2,.85,.2,1), background .25s ease;
}

.elgatec-backtop__core::after {
  content: "";
  position: absolute;
  width: 78%;
  height: 1px;
  top: 9px;
  left: -85%;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  opacity: .65;
  transform: rotate(-25deg);
  animation: elgatec-backtop-scan 2.8s ease-in-out infinite;
}

.elgatec-backtop svg {
  width: 34px;
  height: 34px;
  overflow: visible;
}

.elgatec-backtop__chevron,
.elgatec-backtop__stem {
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(80,225,244,.72));
}

.elgatec-backtop__spark {
  fill: #ffe066;
  filter: drop-shadow(0 0 5px rgba(255,224,102,.68));
  transform-origin: 36px 12px;
  animation: elgatec-backtop-spark 1.7s ease-in-out infinite;
}

.elgatec-backtop__label {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  min-width: max-content;
  padding: 7px 10px 6px;
  border: 1px solid rgba(56,216,237,.28);
  border-radius: 9px;
  color: #dffaff;
  background: rgba(3,24,36,.92);
  box-shadow: 0 10px 28px rgba(2,19,29,.2);
  font: 800 9px/1 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .15em;
  opacity: 0;
  transform: translate(8px,-50%);
  pointer-events: none;
  transition: opacity .2s ease, transform .24s ease;
}

.elgatec-backtop:hover,
.elgatec-backtop:focus-visible {
  transform: translate3d(0,-4px,0) scale(1.035);
}

.elgatec-backtop:hover::before,
.elgatec-backtop:focus-visible::before {
  animation-duration: 1.25s;
  filter: drop-shadow(0 12px 24px rgba(32,210,235,.42));
}

.elgatec-backtop:hover .elgatec-backtop__core,
.elgatec-backtop:focus-visible .elgatec-backtop__core {
  background: linear-gradient(160deg, rgba(17,98,123,.88), rgba(4,31,45,.55));
  transform: translateY(-1px);
}

.elgatec-backtop:hover .elgatec-backtop__label,
.elgatec-backtop:focus-visible .elgatec-backtop__label {
  opacity: 1;
  transform: translate(0,-50%);
}

.elgatec-backtop:focus-visible {
  outline: 3px solid #ffe066;
  outline-offset: 5px;
}

.elgatec-backtop.is-launching .elgatec-backtop__core {
  transform: translateY(-7px) scale(.96);
}

@keyframes elgatec-backtop-orbit {
  to { --elgatec-backtop-angle: 360deg; }
}

@keyframes elgatec-backtop-scan {
  0%, 24% { left: -85%; opacity: 0; }
  42% { opacity: .72; }
  66%, 100% { left: 108%; opacity: 0; }
}

@keyframes elgatec-backtop-spark {
  0%, 100% { opacity: .58; transform: scale(.82) rotate(-5deg); }
  50% { opacity: 1; transform: scale(1.08) rotate(5deg); }
}

@media (max-width: 980px) {
  .elgatec-backtop {
    --elgatec-backtop-bottom: 76px;
    right: 16px;
    width: 52px;
    height: 52px;
    border-radius: 17px;
  }

  .elgatec-backtop__core {
    inset: 6px;
    border-radius: 13px;
  }

  .elgatec-backtop svg {
    width: 31px;
    height: 31px;
  }

  .elgatec-backtop__label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .elgatec-backtop,
  .elgatec-backtop::before,
  .elgatec-backtop__core,
  .elgatec-backtop__core::after,
  .elgatec-backtop__spark {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
