.chat-message {
    .message-header {
        .pf2e-toolbelt-merged-group {
            margin-block: 3px 6px;
            padding: 3px;
            box-shadow: 0 0 4px 0px black;
            border-radius: 2px;

            .actions {
                width: 100%;
            }

            .modifiers .tag[data-visibility="gm"] {
                box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
            }
        }
    }

    .message-content {
        .dice-result {
            .dice-total {
                .pf2e-toolbelt-merge-buttons {
                    position: absolute;
                    right: 1px;
                    bottom: 1px;
                    display: flex;
                    gap: 1px;
                    align-items: center;

                    button {
                        height: 1.4rem;
                        width: 1.4rem;
                        min-height: revert;
                    }
                }
            }

            .dice-formula.show-average {
                > * {
                    z-index: 1;
                }

                &::before {
                    content: "";
                    position: absolute;
                    inset: 0;
                    right: min((1 - var(--average-ratio)) * 100%, 100% - 4px);
                    background: hsl(var(--average-hue) 100% 40% / 0.4);
                    pointer-events: none;
                }
            }
        }

        .average-display {
            position: relative;
            display: flex;
            justify-content: space-between;
            padding: 0 4px;
            margin-bottom: 2px;
            border: 1px solid #999;
            border-radius: 3px;
            font-size: 0.8em;
            line-height: 1;

            &::before {
                content: "";
                position: absolute;
                inset: 0;
                right: calc((1 - var(--average-ratio)) * 100%);
                background: hsl(var(--average-hue) 100% 40% / 1);
            }

            span {
                z-index: 1;
            }

            + .damage-roll {
                margin-top: 0.3em;
            }
        }
    }
}

.application.dialog.pf2e-toolbelt-merge-damage-menu {
    .dialog-content {
        display: grid;
        grid-template-columns: 1fr 1fr;

        .message {
            display: flex;
            flex-direction: column;
            gap: 0.2em;

            h3 {
                font-size: 1.5em;
                margin-bottom: 0.5rem;
            }

            label {
                display: flex;
                align-items: center;
                gap: 0.3em;
            }
        }
    }
}
