/* r107-r78: formatted text in messages (qchat-text-format.js). Colours follow
   the bubble's own text colour, so sent/received and dark theme just work. */
.qchat-fmt-bold { font-weight: 700; }
.qchat-fmt-italic { font-style: italic; }
.qchat-fmt-strike { text-decoration: line-through; }

.qchat-fmt-code,
.qchat-fmt-pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.88em;
    background: rgba(127, 127, 127, 0.16);
    border-radius: 4px;
}
.qchat-fmt-code { padding: 0.05em 0.3em; overflow-wrap: anywhere; }
.qchat-fmt-pre {
    margin: 0.25em 0;
    padding: 0.45em 0.6em;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    color: inherit;
    border: 0;
}
.qchat-fmt-pre code { font: inherit; color: inherit; background: none; padding: 0; }

.qchat-fmt-quote {
    margin: 0.2em 0;
    padding: 0.1em 0 0.1em 0.6em;
    border-left: 3px solid currentColor;
    border-left-color: rgba(127, 127, 127, 0.55);
    opacity: 0.9;
    font-style: normal;
    font-size: inherit;
}

.qchat-fmt-spoiler {
    border-radius: 4px;
    cursor: pointer;
    color: transparent;
    background: rgba(127, 127, 127, 0.55);
    transition: color 0.2s ease, background-color 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}
.qchat-fmt-spoiler > * { visibility: hidden; }
.qchat-fmt-spoiler.is-revealed {
    cursor: auto;
    color: inherit;
    background: rgba(127, 127, 127, 0.12);
    -webkit-user-select: text;
    user-select: text;
}
.qchat-fmt-spoiler.is-revealed > * { visibility: visible; }
.qchat-fmt-spoiler:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }

/* The bar over the composer while text is selected. */
.qchat-fmt-bar {
    /* r107-r99: never squeezed by a tight column (the group chat). */
    flex: 0 0 auto;
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding: 3px 4px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: rgba(127, 127, 127, 0.12);
}
.qchat-fmt-bar[hidden] { display: none; }
.qchat-fmt-bar-btn {
    flex: 0 0 auto;
    min-width: 34px;
    height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 0.95rem;
    line-height: 30px;
}
.qchat-fmt-bar-btn:hover,
.qchat-fmt-bar-btn:focus-visible { background: rgba(127, 127, 127, 0.22); }
.qchat-fmt-bar-bold { font-weight: 700; }
.qchat-fmt-bar-italic { font-style: italic; font-family: Georgia, serif; }
.qchat-fmt-bar-strike { text-decoration: line-through; }
.qchat-fmt-bar-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; }

/* r107-r79: the message field that shows formatting while typing
   (qchat-rich-composer.js). It keeps the textarea's id and classes, so the
   existing composer geometry applies; only what a <div> does differently is
   set here. */
.qchat-rich-editor {
    display: block;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere;
    word-break: normal;
    cursor: text;
    text-align: start;
    -webkit-user-select: text;
    user-select: text;
}
.qchat-rich-editor:focus { outline: 0; }
.qchat-rich-editor:empty::before {
    content: attr(placeholder);
    color: #6c757d;
    pointer-events: none;
}
body.dark-theme .qchat-rich-editor:empty::before { color: #8b949e; }
.qchat-rich-editor.qchat-rich-disabled {
    cursor: default;
    background-color: rgba(127, 127, 127, 0.12);
}
.qchat-rich-editor .qchat-fmt-spoiler-edit {
    color: inherit;
    cursor: text;
    background: rgba(127, 127, 127, 0.3);
    -webkit-user-select: text;
    user-select: text;
}
.qchat-rich-editor .qchat-fmt-spoiler-edit > * { visibility: visible; }
.qchat-rich-editor .qchat-fmt-quote { margin: 0.1em 0; }
.qchat-rich-editor .qchat-fmt-pre { margin: 0.1em 0; white-space: pre-wrap; }
.qchat-rich-emoji {
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.22em;
    object-fit: contain;
}


/* Leave room above the selected text for Android's floating edit menu. */
.qchat-fmt-bar-android {
    margin-bottom: 56px;
}
