Thunno 2, 1811 bytes
ı'/=ẋ_ðx×n+£nChEẋ+JCPDḌ€ḷṡ+ðṙ
Port of emanresu A's Vyxal answer.
Requires Thunno \$\ge 2.1.10\$. ATO is on \$2.1.9\$ 😢.Attempt This Online!
Explanation
ı'/=ẋ_ðx×n+£nChEẋ+JCPDḌ€ḷṡ+ðṙ # Implicit input
ı JC # Map overCharcodes theof input string:
'/= # Is the current character a forward slash?
ẋ_ PD # IfAre soprime, decrement xduplicate
ðx× Ḍ€ḷ # Push xDouble, spacescomplement
n+ ṡ+ # And addAdd to the current character
£ # Print with a trailing newlinecumsums
nChE ðṙ # Is the current character a backslash?Right-justify
ẋ+ # If so, incrementImplicit xoutput