#toc_container.sp-toc-ready {
  position: relative;
}

#toc_container.sp-toc-ready .toc_toggle {
  display: none;
}

#toc_container .sp-toc-scroll {
  position: relative;
  overflow: hidden;
  transition: max-height 0.28s ease;
  will-change: max-height;
}

#toc_container.sp-toc-ready.sp-toc-collapsed .sp-toc-scroll::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 54px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(249, 249, 249, 0) 0%,
    rgba(249, 249, 249, 0.88) 70%,
    #f9f9f9 100%
  );
}

#toc_container .sp-toc-actions {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
  background: #f9f9f9;
}

#toc_container.sp-toc-ready:not(.sp-toc-needs-toggle) .sp-toc-actions,
#toc_container.sp-toc-expanded .sp-toc-actions {
  display: none;
}

#toc_container .sp-toc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  width:100%;
  padding: 4px 12px;
  border: none;
  border-radius: 999px;
  background: #f9f9f9;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  box-shadow: none;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
  transition: color 0.18s ease, background-color 0.18s ease;
}

#toc_container .sp-toc-toggle:hover {
  background: #f1f1f1;
  color: #333;
}

#toc_container .sp-toc-toggle:focus-visible {
  outline: 2px solid rgba(72, 101, 178, 0.25);
  outline-offset: 3px;
}

#toc_container .sp-toc-toggle-icon {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

#toc_container.sp-toc-expanded .sp-toc-scroll::after {
  display: none;
}

@media screen and (max-width: 600px) {
  #toc_container .sp-toc-actions {
    padding-top: 7px;
    padding-bottom: 0;
  }

  #toc_container .sp-toc-toggle {
    min-height: 28px;
    padding: 4px 10px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #toc_container .sp-toc-scroll,
  #toc_container .sp-toc-toggle {
    transition: none;
  }
}