Index: src/wp-includes/admin-bar.php
===================================================================
--- src/wp-includes/admin-bar.php	(revision 59027)
+++ src/wp-includes/admin-bar.php	(working copy)
@@ -1306,11 +1306,10 @@
 	}
 	remove_action( 'wp_head', $header_callback );
 
-	$css = '
-		@media screen { html { margin-top: 32px !important; } }
-		@media screen and ( max-width: 782px ) { html { margin-top: 46px !important; } }
-	';
-	wp_add_inline_style( 'admin-bar', $css );
+	wp_add_inline_style(
+		'admin-bar',
+		'@media screen { html { margin-top: var(--wp-admin--admin-bar--height, 32px) !important; } }'
+	);
 }
 
 /**
