Expected: the badge sits in the top-right corner of the host box. The host is the nearest positioned ancestor in the flattened tree, so the shadow tree's absolutely positioned child is placed against it — the shadow boundary does not create a containing block of its own.
Expected: the light-DOM badge lands in the bottom-left corner of the green shadow panel, not of the page — its containing block is the positioned element inside the shadow tree, because that is its ancestor in the flattened tree.
Expected: the tall striped block inside the shadow tree is cut off at the
host's 60px height — overflow: hidden on the host clips shadow
content exactly as it would clip light-DOM children.
Expected: the yellow document layer (z-index: 5) paints
over the blue shadow layer, even though the shadow layer asks for
z-index: 999. The host establishes a stacking context with
z-index: 1, and its descendants are trapped inside it.