& {
    .titlebar-spacer[type="post-tabs"] {
		margin-inline-end: var(--gap-size) !important; // Add spacing between caption buttons and tabs.
	}
    
    // Give the tabs/Incognito/pfp the appropriate offset
	#private-browsing-indicator-with-label,
    .private-browsing-indicator-with-label /* Fix for Firefox 133+ */,
    #gkavatar-container {
        order: 998 !important; // Force to right
    }
    .titlebar-spacer[type="post-tabs"] {
        order: 999 !important; // Force to right of Incognito
    }
    &:not([privatebrowsingmode="temporary"]) #TabsToolbar-customization-target {
		margin-inline-end: var(--tab-distance-from-toolbar-edge);
	}
    // Incognito can't use this^ spacing, so we need to set it separately for Incognito
    &[privatebrowsingmode="temporary"] {
        #private-browsing-indicator-with-label,
		.private-browsing-indicator-with-label /* Fix for Firefox 133+ */ {
            margin-inline-end: var(--tab-distance-from-toolbar-edge);
        }
    }
    #gkavatar-container > #gk-firefox-account-button,
    .private-browsing-indicator-icon {
        margin-inline-start: var(--tab-distance-from-pfp) !important;
        margin-inline-end: 1px !important;
    }

    // Flip Incognito and appropriate profile icons
    #private-browsing-indicator-with-label,
    .private-browsing-indicator-with-label /* Fix for Firefox 133+ */,
    &:not([profilepic="firefox"], [profilepic="geckium"]) #gkavatar-container #fxa-avatar-image {
        transform: scaleX(-1);
    }

    // Tweaks for Profile Titlebutton
    #gkpeople-button-container {
        margin-inline-start: 6px !important;
    }

    // Show the Google logo after the buttons if enabled
    &[gkbranding="chrome"][geckium-chrflag-other-platforms-watermark="true"] {
		&[privatebrowsingmode="temporary"],
		&:not([gkpeoplestyle="titlebutton"]) {
			.titlebar-buttonbox-container::after {
				content: url("chrome://userchrome/content/assets/img/chrome-1/titlebar/windows/google.png");
				margin-block-start: 2px;
				margin-inline-start: 7px;
			}
			&[sizemode="maximized"],
			&[sizemode="fullscreen"] {
				.titlebar-buttonbox-container::after {
					content: unset !important;
				}
			}
		}
        &:not([privatebrowsingmode="temporary"]),
		&[gkpeoplestyle="titlebutton"] {
			#gkpeople-button-container::before {
				content: url("chrome://userchrome/content/assets/img/chrome-1/titlebar/windows/google.png");
				margin-block-start: 2px;
				margin-inline-end: 7px;
			}
			&[sizemode="maximized"],
			&[sizemode="fullscreen"] {
				#gkpeople-button-container::before {
					content: unset !important;
				}
			}
		}
    }

    // NOTE: macOS and Mac OS X BLOCK native titlebars

    // Titlebar button box (force onto left side)
    .titlebar-buttonbox-container {
        order: -1 !important;
        align-items: unset !important;
        margin-inline-start: 8px; // left margin
        margin-block-start: 6px; // top margin
    }
    // Linux quirk: Counteract exclusive menubar padding
    @media (-moz-platform: linux) {
        #toolbar-menubar .titlebar-buttonbox-container {
            margin-block-start: 5px;
        }
    }

    .titlebar-buttonbox {
        align-items: unset !important;
        gap: 7px;
    }
    .titlebar-button::before { // macOS WILL NOT have its buttons filled
		content: unset !important;
	}

    // Shared titlebar button code
    .titlebar-button {
        height: 14px;
        width: 14px;
        border-radius: 100% !important;
        background-clip: padding-box !important;
        transition: none; // Mac OS X lacked an animation for titlebar button-hover
        display: flex !important;

        box-shadow: inset 0 0.8px 2px 1px rgba(0,0,0,0.58),
                    0 1px rgba(255, 255, 255, 0.38);
        list-style-image: unset !important;

        &:not([disabled]):active::after {
			content: "";
			left: 0;
			top: 0;
			right: 0;
			bottom: 0;
			position: absolute;
			border-radius: 100%;
			background: rgba(0,0,0,0.22);
		}
        image {
            -moz-context-properties: fill, fill-opacity !important;
        }
    }

    // Close button
    .titlebar-close:not([disabled]) {
        order: 0 !important;

        background-color: #F63132 !important;
        fill: #A03429 !important;

        &:hover,
        &:active {
            list-style-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/close.svg) !important;
        }
    }
    &:not([geckium-twentyone]) .titlebar-close:not([disabled]) {
        background-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/tlight-close.svg) !important;
    }

    // Minimise button
    .titlebar-min:not([disabled]) {
        order: 1 !important;

        background-color: #F2AD54 !important;
        fill: #6F312A !important;

        &:hover,
        &:active {
            list-style-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/min.svg) !important;
        }
    }
    &:not([geckium-twentyone]) .titlebar-min:not([disabled]) {
        background-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/tlight-min.svg) !important;
    }

    // Maximise and Restore buttons
    &[sizemode="maximized"],
    &[sizemode="fullscreen"] {
        .titlebar-max {
            display: none !important;
        }
    }
    &:not([sizemode="maximized"]):not([sizemode="fullscreen"]) .titlebar-restore {
		display: none !important;
	}
    .titlebar-max:not([disabled]),
    .titlebar-restore:not([disabled]) {
        order: 2 !important;

        background-color: #91BF5C !important;
        fill: #215118 !important;
        
        &:hover,
        &:active {
            list-style-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/zoom.svg) !important;
        }
    }
    &:not([geckium-twentyone]) .titlebar-max:not([disabled]),
    &:not([geckium-twentyone]) .titlebar-restore:not([disabled]) {
        background-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/tlight-zoom.svg) !important;
    }
    
    &:not([geckium-twentyone]) {
        // TODO: When adding the fullscreen titlebutton, display: none it here as it just... didn't exist... until ~21.

        // Graphite
        &[gkmacgraphite="true"] {
            .titlebar-close:not([disabled]),
            .titlebar-min:not([disabled]),
            .titlebar-max:not([disabled]),
            .titlebar-restore:not([disabled]) {
                background-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/tlight-graphite.svg) !important;
                background-color: #9EA3A8 !important;
                fill: #616772 !important;
            }
        }
        // Inactive / Disabled
        &:-moz-window-inactive .titlebar-button:not(:hover, :active),
        .titlebar-button[disabled] {
            background-image: url(chrome://userchrome/content/assets/img/chrome-1/titlebar/macosx/tlight-graphite.svg) !important;
            background-color: #B3B3B3 !important;
            opacity: 50% !important;
        }
        @media (prefers-color-scheme: dark) {
            &:-moz-window-inactive .titlebar-button:not(:hover, :active),
            .titlebar-button[disabled] {
                background-color: #AAA !important;
            }
        }
    }

    /* People Titlebar Button
    #gkpeople-button-container {
        order: 999 !important; // Force to right of Incognito
    } */
}