.markdown {
    :global(.emoji) {
        object-fit: contain;

        height: 1.25em;
        width: 1.25em;
        margin: 0 0.05em 0 0.1em;
        vertical-align: -0.2em;
    }

    &[data-large-emojis="true"] :global(.emoji) {
        width: 3rem;
        height: 3rem;
        margin-bottom: 0;
        margin-top: 1px;
        margin-right: 2px;
        vertical-align: -0.3em;
    }

    p,
    pre {
        margin: 0;
    }

    a {
        text-decoration: none;

        &[data-type="mention"] {
            padding: 0 6px;
            font-weight: 600;
            display: inline-block;
            background: var(--secondary-background);
            border-radius: calc(var(--border-radius) * 2);

            &:hover {
                text-decoration: none;
            }
        }

        &:hover {
            text-decoration: underline;
        }
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    ul,
    ol,
    blockquote {
        margin: 0;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        &:not(:first-child) {
            margin-top: 12px;
        }
    }

    ul,
    ol {
        list-style-position: inside;
        padding-left: 10px;
    }

    blockquote {
        margin: 2px 0;
        padding: 2px 0;
        background: var(--hover);
        border-radius: var(--border-radius);
        border-inline-start: 4px solid var(--tertiary-background);

        > * {
            margin: 0 8px;
        }
    }

    pre {
        padding: 1em;
        overflow-x: scroll;
        border-radius: var(--border-radius);
        background: var(--block) !important;
    }

    p > code {
        padding: 1px 4px;
    }

    code {
        color: white;
        font-size: 90%;
        background: var(--block);
        border-radius: var(--border-radius);
        font-family: var(--monospace-font), monospace;
        border-radius: 3px;
        -webkit-box-decoration-break: clone;
    }

    input[type="checkbox"] {
        margin-right: 4px;
        pointer-events: none;
    }

    table {
        border-collapse: collapse;

        th,
        td {
            padding: 6px;
            border: 1px solid var(--tertiary-foreground);
        }
    }

    :global(.katex-block) {
        overflow-x: auto;
    }

    :global(.spoiler) {
        padding: 0 2px;
        cursor: pointer;
        user-select: none;
        color: transparent;
        background: #151515;
        border-radius: var(--border-radius);

        > * {
            opacity: 0;
            pointer-events: none;
        }

        &:global(.shown) {
            cursor: auto;
            user-select: all;
            color: var(--foreground);
            background: var(--secondary-background);

            > * {
                opacity: 1;
                pointer-events: unset;
            }
        }
    }

    :global(.code) {
        font-family: var(--monospace-font), monospace;

        :global(.lang) {
            width: fit-content;
            padding-bottom: 8px;

            div {
                color: #111;
                cursor: pointer;
                padding: 2px 6px;
                font-weight: 600;
                user-select: none;
                display: inline-block;
                background: var(--accent);

                font-size: 10px;
                text-transform: uppercase;
                box-shadow: 0 2px #787676;
                border-radius: calc(var(--border-radius) / 3);

                &:active {
                    transform: translateY(1px);
                    box-shadow: 0 1px #787676;
                }
            }
        }
    }

    input[type="checkbox"] {
        width: 0;
        opacity: 0;
        pointer-events: none;
    }

    label {
        pointer-events: none;
    }

    input[type="checkbox"] + label:before {
        width: 12px;
        height: 12px;
        content: "a";
        font-size: 10px;
        margin-right: 6px;
        line-height: 12px;
        background: white;
        position: relative;
        display: inline-block;
        border-radius: var(--border-radius);
    }

    input[type="checkbox"][checked="true"] + label:before {
        content: "✓";
        align-items: center;
        display: inline-flex;
        justify-content: center;
        background: var(--accent);
    }

    input[type="checkbox"] + label {
        line-height: 12px;
        position: relative;
    }
}
