/* Live topic headings; the outer reader band stays separate from the compact badge. */
.ct-lesson-page .ct-topic-group { margin-block: 24px; }
.ct-builder-modal .ct-builder-topic-group-fields {
    grid-column: 1 / -1; min-inline-size: 0; margin: 0; padding: 12px;
    display: grid; gap: 10px; border: 1px solid var(--ct-line, #ded8e8); border-radius: 8px;
    background: var(--ct-white, #fff); color: var(--ct-ink, #342840);
}
.ct-builder-modal .ct-builder-topic-group-fields legend { padding-inline: 6px; font-weight: 700; }
.ct-builder-modal .ct-builder-topic-group-fields p { margin: 0; font-size: 13px; line-height: 1.6; }
.ct-lesson-page .ct-topic-group-title {
    display: flex; flex-wrap: wrap; gap: 8px 16px;
    margin: 0; padding: 12px 16px;
    color: #50316e; background: #eee6f7;
    border-inline-start: 4px solid #8058a5; border-radius: 8px;
    font-size: 24px; font-weight: 750; line-height: 1.5;
    overflow-wrap: anywhere;
}
.ct-lesson-page .ct-topic-group > .ct-builder-topic:first-of-type { margin-block-start: 12px; }
.ct-lesson-page .ct-topic-group > .ct-builder-topic:last-child { margin-block-end: 0; }
[data-ct-lesson-theme="dark"] .ct-topic-group-title { color: #e7d9fa; background: #30223f; border-color: #b796da; }
@media (max-width: 600px) { .ct-lesson-page .ct-topic-group-title { font-size: 21px; padding: 10px 12px; } }

.ct-lesson-page .ct-builder-topic-heading.ct-topic-heading-band {
    width: 100%;
    gap: 0;
    background: transparent;
    overflow: visible;
    border-radius: 0;
}
body.ct-lesson-page .ct-topic-heading-badge {
    --ct-heading-surface: #e9e0f3;
    --ct-heading-marker: #745195;
    --ct-heading-ink: #352740;
    --ct-heading-caption: #705887;
    --ct-heading-size: 21px;
    --ct-heading-caption-size: 14px;
    display: flex;
    align-items: stretch;
    flex: 0 1 auto;
    width: fit-content;
    min-width: 0;
    max-width: 100%;
    gap: 0;
    overflow: hidden;
    border: 1px solid #ddcde9;
    border-radius: 8px;
    background: var(--ct-heading-surface);
}
[dir="rtl"] .ct-topic-heading-badge { text-align: right; }
[dir="ltr"] .ct-topic-heading-badge { text-align: left; }
body.ct-lesson-page .ct-topic-heading-badge > .ct-topic-marker.ct-topic-number {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: auto;
    min-height: 44px;
    padding: 7px;
    border: 0;
    border-radius: 0;
    background: var(--ct-heading-marker);
    color: #fff;
    font: 600 16px/1.5 "Inter", sans-serif;
    text-align: center;
    overflow-wrap: anywhere;
}
body.ct-lesson-page .ct-topic-heading-badge[data-topic-marker-type="symbol"] > .ct-topic-marker {
    font-size: 14px;
}
.ct-topic-marker svg { width: 21px; height: 21px; flex-shrink: 0; }
body.ct-lesson-page .ct-topic-heading-badge h2.ct-topic-heading-title {
    display: flex;
    flex: 0 1 auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: auto;
    min-width: 0;
    max-width: none;
    gap: 3px;
    margin: 0;
    padding: 9px 14px;
    border: 0;
    border-radius: 0;
    background: var(--ct-heading-surface);
    color: var(--ct-heading-ink);
    font: 700 var(--ct-heading-size)/1.4 "Inter", sans-serif;
    text-align: inherit;
    overflow-wrap: anywhere;
}
body.ct-lesson-page .ct-topic-heading-badge h2.ct-topic-heading-title > span[lang] {
    display: block;
    max-width: 100%;
    margin: 0;
    color: inherit;
    text-align: inherit;
    overflow-wrap: anywhere;
}
body.ct-lesson-page .ct-topic-heading-badge h2.ct-topic-heading-title > span[lang="ar"] {
    order: 1;
    color: var(--ct-heading-caption);
    font: 600 var(--ct-heading-caption-size)/1.6 "Cairo", sans-serif;
    letter-spacing: normal;
}
body.ct-lesson-page .ct-topic-heading-badge h2.ct-topic-heading-title > span[lang="en"] {
    order: 0;
    color: var(--ct-heading-ink);
    font: inherit;
    letter-spacing: normal;
}
.ct-lesson-page .ct-lesson-builder-editor .ct-topic-heading-badge {
    --ct-heading-size: 18px;
    --ct-heading-caption-size: 12px;
    margin-inline-end: auto;
}
[data-ct-lesson-theme="dark"] body.ct-lesson-page .ct-topic-heading-badge {
    --ct-heading-surface: #36283f;
    --ct-heading-marker: #62437e;
    --ct-heading-ink: #f0e6f6;
    --ct-heading-caption: #d0b8e1;
    border-color: #5b416e;
}
.ct-topic-marker-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
    margin-block: 14px;
}
.ct-topic-marker-fields [data-topic-marker-symbol-field][hidden] { display: none; }
@media (max-width: 600px) {
    body.ct-lesson-page .ct-topic-heading-badge { --ct-heading-size: 18px; --ct-heading-caption-size: 12px; }
    body.ct-lesson-page .ct-topic-heading-badge h2.ct-topic-heading-title { padding: 8px 10px; }
    .ct-lesson-page .ct-lesson-builder-editor .ct-topic-heading-badge { max-width: calc(100% - 28px); }
    .ct-topic-marker-fields { grid-template-columns: minmax(0, 1fr); }
}
