On a general note: It would have been better to replace the props in the .box instead of adding them to .vertical. .vertical should only include writing-mode: vertical-rl;. The logical props in .box would then behave correctly for different writing modes.
Yeah exactly.
Your vertical box has, for example, the correct padding-block-start:40px; but alsopadding-top: 40px; from the .box that doesn’t react to the writing mode. The correct borders get also overwritten by the “wrong” borders of .box.