/* QGabarito | Masters Concursos — Editor rico controlado do Gabarito comentado */
.qg-rich-editor {
    width: 100%;
    border: 1px solid #cfd9e6;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 42, 76, .03);
}

.qg-rich-editor:focus-within {
    border-color: #6ea8dc;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.qg-rich-editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px 10px;
    border-bottom: 1px solid #e5eaf0;
    background: #f8fafc;
}

.qg-rich-editor-button,
.qg-rich-editor-select {
    min-height: 34px;
    border: 1px solid #d5dde8;
    border-radius: 8px;
    background: #fff;
    color: #18324f;
    font: inherit;
    font-size: .86rem;
}

.qg-rich-editor-button {
    min-width: 36px;
    padding: 6px 9px;
    cursor: pointer;
    font-weight: 700;
}

.qg-rich-editor-button:hover,
.qg-rich-editor-select:hover {
    border-color: #9eb6cf;
    background: #f5f9fd;
}

.qg-rich-editor-button:focus-visible,
.qg-rich-editor-select:focus-visible,
.qg-rich-editor-surface:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.qg-rich-editor-button.is-active,
.qg-rich-editor-button[aria-pressed="true"] {
    border-color: #7ca7d1;
    background: #eaf3fb;
    color: #0d3c70;
}

.qg-rich-editor-select {
    max-width: 178px;
    padding: 5px 28px 5px 9px;
    cursor: pointer;
}

.qg-rich-editor-separator {
    width: 1px;
    height: 24px;
    margin: 0 2px;
    background: #dce3eb;
}

.qg-rich-editor-surface {
    min-height: 310px;
    max-height: 68vh;
    overflow: auto;
    padding: 20px 22px;
    color: #1f2937;
    font-size: 1rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
    caret-color: #123d69;
}

.qg-rich-editor-surface:empty::before {
    content: attr(data-placeholder);
    color: #98a2b3;
    pointer-events: none;
}

.qg-rich-editor-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 11px;
    border-top: 1px solid #e5eaf0;
    background: #fbfcfe;
    color: #667085;
    font-size: .78rem;
}

.qg-rich-editor-count {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Conteúdo editorial rico: mesmas classes são usadas no editor e na leitura. */
.qg-rich-commentary p,
.answer-commentary-text p,
.editorial-commentary-text p,
.version-commentary-text p,
.study-commentary-rich p {
    margin: 0 0 1em;
}

.qg-rich-commentary p:last-child,
.answer-commentary-text p:last-child,
.editorial-commentary-text p:last-child,
.version-commentary-text p:last-child,
.study-commentary-rich p:last-child {
    margin-bottom: 0;
}

.qg-rich-commentary h2,
.answer-commentary-text h2,
.editorial-commentary-text h2,
.version-commentary-text h2,
.study-commentary-rich h2 {
    margin: 1.35em 0 .55em;
    color: #102a4c;
    font-size: 1.3em;
    line-height: 1.35;
}

.qg-rich-commentary h3,
.answer-commentary-text h3,
.editorial-commentary-text h3,
.version-commentary-text h3,
.study-commentary-rich h3 {
    margin: 1.2em 0 .5em;
    color: #173b67;
    font-size: 1.12em;
    line-height: 1.4;
}

.qg-rich-commentary ul,
.qg-rich-commentary ol,
.answer-commentary-text ul,
.answer-commentary-text ol,
.editorial-commentary-text ul,
.editorial-commentary-text ol,
.version-commentary-text ul,
.version-commentary-text ol,
.study-commentary-rich ul,
.study-commentary-rich ol {
    margin: .75em 0 1em 1.45em;
    padding: 0;
}

.qg-rich-commentary li,
.answer-commentary-text li,
.editorial-commentary-text li,
.version-commentary-text li,
.study-commentary-rich li {
    margin: .35em 0;
}

.qg-rich-commentary blockquote,
.answer-commentary-text blockquote,
.editorial-commentary-text blockquote,
.version-commentary-text blockquote,
.study-commentary-rich blockquote {
    margin: 1em 0;
    padding: .8em 1em;
    border-left: 4px solid #9cb9d6;
    border-radius: 0 8px 8px 0;
    background: #f6f9fc;
    color: #344054;
}

.qg-rich-commentary a,
.answer-commentary-text a,
.editorial-commentary-text a,
.version-commentary-text a,
.study-commentary-rich a {
    color: #075ea8;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.qg-rich-commentary sup,
.qg-rich-commentary sub,
.answer-commentary-text sup,
.answer-commentary-text sub,
.editorial-commentary-text sup,
.editorial-commentary-text sub,
.version-commentary-text sup,
.version-commentary-text sub,
.study-commentary-rich sup,
.study-commentary-rich sub {
    font-size: .78em;
}

.qg-text-blue { color: #173b67 !important; }
.qg-text-red { color: #b42318 !important; }
.qg-text-green { color: #067647 !important; }
.qg-text-gray { color: #667085 !important; }
.qg-highlight-yellow { background: #fff3b0 !important; border-radius: 3px; padding: 0 .08em; }
.qg-highlight-green { background: #dff6e8 !important; border-radius: 3px; padding: 0 .08em; }
.qg-highlight-blue { background: #e6f2ff !important; border-radius: 3px; padding: 0 .08em; }


/* QG_THEME_ATOMIC_V1: dark manual, sem dependência do sistema operacional. */
html[data-theme="dark"] .qg-rich-editor {
        border-color: #40546b;
        background: #111827;
    }

html[data-theme="dark"] .qg-rich-editor-toolbar,
html[data-theme="dark"] .qg-rich-editor-footer {
        border-color: #334155;
        background: #172033;
        color: #cbd5e1;
    }

html[data-theme="dark"] .qg-rich-editor-button,
html[data-theme="dark"] .qg-rich-editor-select {
        border-color: #40546b;
        background: #111827;
        color: #e2e8f0;
    }

html[data-theme="dark"] .qg-rich-editor-surface {
        color: #e5e7eb;
    }

html[data-theme="dark"] .qg-rich-commentary h2,
html[data-theme="dark"] .qg-rich-commentary h3,
html[data-theme="dark"] .answer-commentary-text h2,
html[data-theme="dark"] .answer-commentary-text h3,
html[data-theme="dark"] .editorial-commentary-text h2,
html[data-theme="dark"] .editorial-commentary-text h3,
html[data-theme="dark"] .version-commentary-text h2,
html[data-theme="dark"] .version-commentary-text h3 {
        color: #dbeafe;
    }


html[data-theme="dark"] .qg-rich-editor {
    border-color: #40546b;
    background: #111827;
}
html[data-theme="dark"] .qg-rich-editor-toolbar,
html[data-theme="dark"] .qg-rich-editor-footer {
    border-color: #334155;
    background: #172033;
    color: #cbd5e1;
}
html[data-theme="dark"] .qg-rich-editor-button,
html[data-theme="dark"] .qg-rich-editor-select {
    border-color: #40546b;
    background: #111827;
    color: #e2e8f0;
}
html[data-theme="dark"] .qg-rich-editor-surface { color: #e5e7eb; }

@media (max-width: 700px) {
    .qg-rich-editor-toolbar { gap: 5px; padding: 8px; }
    .qg-rich-editor-select { max-width: 145px; }
    .qg-rich-editor-separator { display: none; }
    .qg-rich-editor-surface { min-height: 260px; padding: 16px; }
    .qg-rich-editor-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
}
