.gfc .gfc-markdown-editor [hidden] {
    display: none !important;
}

.gfc .gfc-markdown-editor .gfc-markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    padding: 5px;
    border: 1px solid var(--gfc-subtle);
    border-radius: 7px;
    background: var(--gfc-panel);
}

.gfc .gfc-markdown-editor .gfc-markdown-toolbar > button {
    min-width: 38px;
    min-height: 38px;
    margin: 0;
    padding: 8px;
    border-color: transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--gfc-heading);
    font-size: .9rem;
    line-height: 1.2;
    box-shadow: none;
}

.gfc .gfc-markdown-editor .gfc-markdown-toolbar > button:hover {
    border-color: var(--gfc-accent);
    background: var(--gfc-bg);
}

.gfc .gfc-markdown-editor .gfc-markdown-toolbar > .gfc-markdown-image-button {
    margin-inline-start: auto;
    border-color: var(--gfc-subtle);
    white-space: normal;
}

.gfc .gfc-markdown-editor > textarea {
    display: block;
    width: 100%;
    margin: 0;
    resize: vertical;
}

.gfc .gfc-markdown-editor .gfc-message-counter {
    display: block;
    margin: 6px 0 0;
}

.gfc .gfc-markdown-editor .gfc-editor-image-details {
    margin-top: 12px;
}

.gfc .gfc-markdown-editor .gfc-editor-image-existing,
.gfc .gfc-markdown-editor .gfc-editor-file-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.gfc .gfc-markdown-editor .gfc-editor-image-existing {
    margin-bottom: 10px;
}

.gfc .gfc-markdown-editor .gfc-editor-image-existing img {
    width: 56px;
    height: 56px;
    margin: 0;
    border-radius: 6px;
    object-fit: cover;
}

.gfc .gfc-markdown-editor .gfc-editor-image-preview {
    width: fit-content;
    max-width: 100%;
    margin: 0 0 10px;
    overflow: hidden;
    border: 1px solid var(--gfc-subtle);
    border-radius: 6px;
}

.gfc .gfc-markdown-editor .gfc-editor-image-preview img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 180px;
    margin: 0;
    object-fit: contain;
}

.gfc .gfc-markdown-editor .gfc-editor-spoiler {
    margin-top: 10px;
}

.gfc .gfc-markdown-editor .gfc-editor-file-status > p {
    flex: 1 1 150px;
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.gfc .gfc-markdown-editor .gfc-editor-file-status:has(button:not([hidden])),
.gfc .gfc-markdown-editor .gfc-editor-file-status:has(p:not(:empty)),
.gfc .gfc-markdown-editor .gfc-editor-file {
    margin-top: 10px;
}

@media (max-width: 767px) {
    .gfc .gfc-markdown-editor .gfc-markdown-toolbar > button {
        min-width: 44px;
        min-height: 44px;
    }

    .gfc .gfc-markdown-editor .gfc-markdown-toolbar > .gfc-markdown-image-button {
        margin-inline-start: 0;
    }
}
