#fact-app {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px;
    align-items: flex-start;
}

#fact-sidebar-backdrop,
.fact-sidebar-edge-tab {
    display: none;
}

.fact-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fact-sidebar.fact-sidebar-pinned {
    position: fixed;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

/* On tablet/touch, people scroll with a finger — the visible scrollbar
   bar itself isn't needed there, only on a real PC. Scrolling still
   works exactly the same; only the bar's own visuals are hidden. */
.fact-sidebar-hide-scrollbar {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* old Edge/IE */
}
.fact-sidebar-hide-scrollbar::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

#fact-feed-col {
    flex: 1;
    min-width: 230px;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Tablet / landscape phone: narrower sidebars so the feed keeps most of
   the width, instead of two 220px columns squeezing it down. */
@media (max-width: 1500px) and (min-width: 651px) {
    .fact-sidebar {
        width: 160px;
    }
    #fact-feed-col {
        max-width: none;
    }
}

@media (max-width: 650px), (max-width: 700px) and (orientation: portrait) {
    #fact-app {
        display: block;
        position: relative;
        overflow: hidden;
        padding: 0;
    }
    #fact-feed-col {
        max-width: 100%;
        margin: 0;
    }

    .fact-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        width: 82%;
        max-width: 320px;
        flex-direction: column;
        overflow-y: auto;
        z-index: 999999;
        background: #f4f6f8;
        padding: 16px;
        box-shadow: 0 0 24px rgba(0,0,0,0.25);
        transition: transform 0.25s ease;
    }

    .fact-sidebar-left {
        left: 0;
        transform: translateX(-100%);
    }
    .fact-sidebar-left.fact-sidebar-open {
        transform: translateX(0);
    }

    .fact-sidebar-right {
        right: 0;
        transform: translateX(100%);
    }
    .fact-sidebar-right.fact-sidebar-open {
        transform: translateX(0);
    }

    #fact-sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999998;
    }
    #fact-sidebar-backdrop.fact-sidebar-backdrop-visible {
        display: block;
    }

    /* Small edge tabs hint that there's something to swipe/tap open */
    .fact-sidebar-edge-tab {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        width: 22px;
        height: 60px;
        background: rgba(60,150,198,0.85);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        z-index: 999997;
        border-radius: 0 8px 8px 0;
    }
    .fact-sidebar-edge-tab-left {
        left: 0;
    }
    .fact-sidebar-edge-tab-right {
        right: 0;
        border-radius: 8px 0 0 8px;
    }
}


/* ---------- Widgets ---------- */

.fact-widget {
    background: #fff;
    border: 1px solid #e2e5e8;
    border-radius: 10px;
    padding: 14px;
}

.fact-widget-verse {
    background: linear-gradient(180deg, #eaf5fb 0%, #dcedf7 100%);
    border-color: #cfe6f3;
    text-align: center;
    padding: 8px 8px 6px;
}

.fact-widget-verse .fact-widget-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #1a5f8c;
    text-align: center;
    margin: 0 0 10px;
}

.fact-verse-text {
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 16px;
    line-height: 1.5;
    color: #1f3a4d;
    margin: 0 0 8px;
    text-align: center;
}

.fact-verse-reference {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13px;
    color: #3c96c6;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
    margin: 0;
}

/* Safety net for the tablet-compact state — a CSS class applied
   alongside the JS inline styles, forcing the tight line-height with
   maximum priority in case the inline style alone isn't taking effect
   for some reason. */
.fact-verse-tablet-compact {
    margin: 0 0 6px !important;
}

.fact-widget-interest {
    background: linear-gradient(180deg, #fff4e8 0%, #ffe9d1 100%);
    border-color: #f6d9b8;
    text-align: center;
    padding: 8px 8px 6px;
}

.fact-widget-interest .fact-widget-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #b8722a;
    text-align: center;
    margin: 0 0 6px;
}

.fact-interest-text {
    font-size: 12px;
    line-height: 1.4;
    color: #6b4a26;
    margin: 0 0 8px;
    text-align: center;
}

#fact-interest-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#fact-interest-email {
    box-sizing: border-box;
    height: 26px;
    padding: 0 10px;
    border: 1px solid #f0c896;
    border-radius: 16px;
    font-size: 12px;
    text-align: center;
}

#fact-interest-submit {
    box-sizing: border-box;
    height: 28px;
    border: none;
    border-radius: 16px;
    background: #d98a34;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#fact-interest-submit:hover {
    background: #c47a29;
}

#fact-interest-submit:disabled {
    opacity: 0.7;
    cursor: default;
}

.fact-interest-success {
    font-size: 12px;
    color: #6b4a26;
    margin: 0;
}

.fact-widget-title {
    font-size: 14px;
    margin: 0 0 10px;
}

.fact-widget-ad {
    background: #f4f6f8;
    border: 1px dashed #ccc;
    border-radius: 10px;
    padding: 30px 10px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.fact-widget-article {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    margin-bottom: 10px;
}

.fact-widget-article-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.fact-widget-article-title {
    font-size: 13px;
    line-height: 1.3;
}

.fact-widget-image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.fact-widget-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
}

/* ---------- Composer ---------- */

#fact-composer {
    background: #fff;
    border: 1px solid #e2e5e8;
    border-radius: 10px;
    padding: 12px 14px;
}

#fact-composer-text {
    width: 100%;
    box-sizing: border-box;
    border: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

#fact-composer-preview {
    position: relative;
    display: inline-block;
}

.fact-composer-preview-inner img,
.fact-composer-preview-inner video {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
}

#fact-composer-preview-cancel {
    position: absolute;
    top: 0;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #333;
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

#fact-composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

#fact-composer-progress-wrap {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

#fact-composer-progress-bar {
    height: 100%;
    width: 0;
    background: #3c96c6;
    transition: width 0.15s ease;
}

/* ---------- Optimistic pending post ---------- */

.fact-item-pending {
    position: relative;
    opacity: 1;
}

.fact-pending-overlay {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.3s ease;
    opacity: 1;
}

.fact-pending-overlay-hidden {
    opacity: 0;
    pointer-events: none;
}

.fact-pending-progress-wrap {
    flex: 1;
    height: 5px;
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
    overflow: hidden;
}

.fact-pending-progress-bar {
    height: 100%;
    width: 0;
    background: #fff;
    transition: width 0.15s ease;
}

.fact-pending-label {
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
}

.fact-pending-error {
    color: #ffb4b4;
    font-size: 12px;
    flex: 1;
}

.fact-pending-dismiss {
    background: none;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
}

.fact-composer-attach {
    cursor: pointer;
    font-size: 18px;
}

#fact-composer-submit {
    background: #3c96c6;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

#fact-composer-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

#fact-publish-open-btn {
    background: #fff;
    border: 1px solid #3c96c6;
    color: #3c96c6;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

/* ---------- Publish modal ---------- */

#fact-publish-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    touch-action: none;
    overscroll-behavior: none;
}

#fact-publish-box {
    touch-action: none;
    overscroll-behavior: none;
}

#fact-publish-box {
    background: #fff;
    border-radius: 12px;
    width: 680px;
    max-width: 100%;
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 650px) {
    #fact-publish-box {
        height: 94vh;
        max-height: 94vh;
    }
}

/* Tablets: full-screen too, same reasoning as mobile — a floating,
   narrower box has less room to work comfortably with a long article. */
@media (min-width: 651px) and (max-width: 1000px) {
    #fact-publish-overlay {
        padding: 0;
    }
    #fact-publish-box {
        width: 100%;
        max-width: 100%;
        height: 94vh;
        max-height: 94vh;
        border-radius: 0;
    }
}

/* Never scrolls away — title and toolbar are always right there, exactly
   like the article reading window's own button bar already does. Only
   the middle section (the actual text) scrolls. */
#fact-publish-fixed-top {
    flex-shrink: 0;
    padding: 0 0 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#fact-publish-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    padding: 0 12px;
}

#fact-publish-close {
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
}

#fact-publish-title {
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

#fact-publish-toolbar {
    display: flex;
    flex-direction: column;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
    box-sizing: border-box;
    overflow: visible;
    position: relative;
}

#fact-publish-toolbar-placeholder {
    height: 0;
    flex-shrink: 0;
}

.fact-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1px;
    padding: 5px 3px;
    flex-wrap: nowrap;
}

/* On a wider screen the row itself is much wider than the ~20 small
   buttons need — space-between was stretching them out with big ugly
   gaps between each one. Group them together at a comfortable size
   instead, with the row's own leftover space just staying empty at the
   end rather than being distributed between every single button. */
@media (min-width: 651px) {
    .fact-toolbar-row {
        justify-content: space-evenly;
        gap: 8px;
        padding: 12px 16px;
    }

    .fact-toolbar-btn {
        min-width: 48px;
        height: 48px;
        font-size: 19px;
        padding: 0 10px;
    }

    .fact-toolbar-select,
    .fact-toolbar-dropdown-btn {
        height: 48px;
        font-size: 17px;
    }

    #fact-toolbar-color-btn span {
        font-size: 20px;
    }
}

#fact-toolbar-row-1 {
    border-bottom: 1px solid #eee;
}

#fact-toolbar-color-btn {
    font-weight: 700;
    font-size: 13px;
}

#fact-toolbar-color-btn span {
    display: block;
    width: 100%;
    text-align: center;
    padding-bottom: 1px;
}

/* A small down-arrow marks buttons that open a menu, rather than acting
   right away — so it's clear at a glance which ones do what. */
.fact-toolbar-dropdown-btn::after {
    content: '▾';
    font-size: 8px;
    margin-left: 2px;
    color: #888;
}

/* Every small dropdown (paragraph style, font, size, color) shares this
   same popup look — a plain floating panel of real buttons, not a native
   <select>, so its size is fully ours to control everywhere. */
.fact-toolbar-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 6px;
    z-index: 10;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 6px;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
    max-height: 220px;
    overflow-y: auto;
}

.fact-toolbar-popup button {
    background: #fff;
    border: none;
    text-align: left;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.fact-toolbar-popup button:hover {
    background: #eaf5fb;
}

#fact-toolbar-color-popup {
    display: none;
    grid-template-columns: repeat(8, 22px);
    gap: 4px;
    min-width: 0;
}

#fact-toolbar-color-popup .fact-toolbar-color {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    padding: 0;
}

#fact-toolbar-link-row {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid #ddd;
}

#fact-toolbar-link-input {
    box-sizing: border-box;
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid #3c96c6;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

#fact-toolbar-link-confirm,
#fact-toolbar-link-cancel {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

#fact-toolbar-link-confirm {
    background: #3c96c6;
    color: #fff;
    border: none;
}

#fact-toolbar-link-cancel {
    background: #fff;
    border: 1px solid #ddd;
    color: #666;
}

#fact-publish-box.fact-publish-box-fullscreen {
    width: 100% !important;
    height: 100vh !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
}

#fact-publish-overlay:has(.fact-publish-box-fullscreen) {
    padding: 0;
}

/* This is the only part that actually scrolls — a long article slides
   past underneath the toolbar above, never the other way around. */
#fact-publish-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

/* Also never scrolls away — Cancel/Preview/Publish stay reachable no
   matter how long the article is. */
#fact-publish-fixed-bottom {
    flex-shrink: 0;
    padding: 8px 12px 10px;
    border-top: 1px solid #eee;
}

.fact-toolbar-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 30px;
    height: 30px;
    padding: 0 3px;
    box-sizing: border-box;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.fact-toolbar-select {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    height: 24px;
    max-width: 68px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 10px;
    padding: 0 2px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    line-height: 22px;
}

.fact-toolbar-btn:hover {
    background: #eaf5fb;
}

#fact-toolbar-color-swatches {
    display: flex;
    gap: 4px;
    margin-left: 6px;
    padding-left: 6px;
    border-left: 1px solid #ddd;
}

.fact-toolbar-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ccc;
    cursor: pointer;
    padding: 0;
}

/* Contenteditable editor — the image sits inline inside it (floated), so
   typed text actually wraps around it in the same space. */
#fact-publish-editor {
    border-radius: 0 0 8px 8px;
    box-sizing: border-box;
    min-height: 140px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    overflow: auto;
}

#fact-publish-editor:empty::before {
    content: attr(data-placeholder);
    color: #999;
}

#fact-publish-editor h1,
.fact-item-rich-content h1,
#upro-article-modal-content h1 {
    font-size: 24px;
    margin: 0 0 10px;
}

#fact-publish-editor h2,
.fact-item-rich-content h2,
#upro-article-modal-content h2 {
    font-size: 19px;
    margin: 0 0 8px;
}

#upro-article-modal-content h3 {
    font-size: 17px;
    margin: 0 0 8px;
}

#upro-article-modal-content h4 {
    font-size: 16px;
    margin: 0 0 6px;
}

#upro-article-modal-content h5 {
    font-size: 15px;
    margin: 0 0 6px;
}

#upro-article-modal-content h6 {
    font-size: 14px;
    margin: 0 0 6px;
}

.fact-publish-inline-media-wrap {
    display: block;
    float: left;
    width: 320px;
    height: 240px;
    max-width: 90%;
    margin: 0 12px 8px 0;
    resize: both;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #3c96c6;
    position: relative;
}

.fact-publish-inline-media-handle {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    background: #3c96c6;
    color: #fff;
    font-size: 13px;
    line-height: 22px;
    text-align: center;
    border-radius: 4px 0 6px 0;
    cursor: nwse-resize;
    touch-action: none;
    z-index: 2;
}

.fact-publish-inline-media-wrap img,
.fact-publish-inline-media-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fact-publish-inline-media-uploading::after {
    content: 'Uploading…';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Rendered in the feed — same wrap-around look as the editor, just
   read-only (no resize handle once published). */
.fact-item-rich-content {
    overflow: auto; /* contains the floated image so the card sizes correctly */
    font-size: 14px;
    line-height: 1.5;
}

.fact-item-rich-content .fact-publish-inline-media-wrap {
    resize: none;
    cursor: default;
}

.fact-item-rich-content .fact-publish-inline-media-wrap::after {
    display: none;
}

@media (max-width: 500px) {
    /* A fixed pixel width (set via the resize handle on desktop) leaves
       almost no room next to it for wrapped text on a narrow screen —
       the text collapses into a single word per line. Full-width and
       block instead: the image sits on its own line, text flows below. */
    .fact-publish-inline-media-wrap,
    .fact-item-rich-content .fact-publish-inline-media-wrap,
    #upro-article-modal-content .fact-publish-inline-media-wrap {
        float: none !important;
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
        margin: 0 0 10px 0;
    }

    .fact-publish-inline-media-wrap img,
    .fact-publish-inline-media-wrap video {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

#fact-publish-progress-wrap {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

#fact-publish-progress-bar {
    height: 100%;
    width: 0;
    background: #3c96c6;
}

#fact-publish-visibility {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    clear: both;
}

.fact-publish-toggle {
    display: inline-block;
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid #d8dde1;
    border-radius: 999px;
    background: #f7f9fa;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
}

.fact-publish-toggle:hover {
    background: #eef1f3;
}

.fact-publish-toggle-active {
    background: #eaf5fb;
    border-color: #3c96c6;
    color: #237ba6;
}

#fact-publish-review-visibility-note {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.fact-item-visibility-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #a06a00;
    background: #fff3cd;
    border-radius: 12px;
    padding: 2px 8px;
    margin-bottom: 6px;
}

#fact-publish-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    clear: both;
    flex-wrap: wrap;
}

#fact-publish-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

#fact-publish-cancel-btn {
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

#fact-publish-cancel-btn:hover {
    background: #f5f5f5;
}

#fact-publish-preview-btn {
    background: #3c96c6;
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

#fact-publish-submit {
    background: #3c96c6;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

#fact-publish-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ---------- Review / preview step ---------- */

#fact-publish-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#fact-publish-review-content {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 14px;
    overflow: auto; /* contains the floated media from the review markup */
}

#fact-publish-review-actions {
    display: flex;
    justify-content: space-between;
}

#fact-publish-back-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

/* ---------- Feed items ---------- */

.fact-item {
    background: #fff;
    border: 1px solid #e2e5e8;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
}

.fact-item-header a {
    text-decoration: none;
    color: inherit;
}

.fact-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.fact-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.fact-item-author {
    font-size: 14px;
    font-weight: 600;
}

.fact-item-time {
    font-size: 12px;
    color: #888;
}

.fact-item-title {
    font-size: 16px;
    margin: 0 0 6px;
    font-weight: 700;
}

.fact-item-content {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.fact-item-image {
    max-width: 100%;
    max-height: 420px;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
}

.fact-item-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 420px;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
    background: #000;
    object-fit: contain;
}

.fact-item-document {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f4f6f8;
    border: 1px solid #e2e5e8;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    text-decoration: none;
    color: inherit;
}

.fact-item-document-icon {
    font-size: 24px;
}

.fact-item-document-name {
    flex: 1;
    font-size: 13px;
    word-break: break-word;
}

.fact-item-document-download {
    font-size: 12px;
    color: #3c96c6;
    white-space: nowrap;
}

.fact-link-card {
    display: block;
    margin-top: 8px;
    border: 1px solid #e2e5e8;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: #f4f6f8;
}

.fact-link-card-image {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    display: block;
}

.fact-link-card-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fact-link-card-title {
    font-size: 14px;
}

.fact-link-card-desc {
    font-size: 13px;
    color: #555;
}

.fact-link-card-domain {
    font-size: 12px;
    color: #3c96c6;
}

.fact-link-loading {
    font-size: 12px;
    color: #888;
}

.fact-video-embed-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.fact-dm-tap-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.fact-dm-play-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: #222;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 4px;
}

.fact-video-embed-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.fact-video-embed-wrap-portrait {
    max-width: 325px;
    padding-top: 0; /* override the 16:9 landscape ratio */
    height: 578px;
    margin-left: auto;
    margin-right: auto;
}

.fact-video-embed-title {
    font-size: 13px;
    color: #555;
    margin-top: 6px;
}

.fact-x-embed-wrap {
    margin-top: 8px;
}

.fact-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.fact-add-reaction {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
}

.fact-add-reaction:hover {
    opacity: 1;
}

.fact-forward-btn {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    margin-left: auto;
}

.fact-forward-btn:hover {
    opacity: 1;
}

.fact-share-btn {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
}

.fact-share-btn:hover {
    opacity: 1;
}

.fact-delete-post-btn {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.5;
}

.fact-delete-post-btn:hover {
    opacity: 1;
}

#fact-load-more-wrap {
    text-align: center;
    margin: 10px 0 30px;
}

#fact-load-more {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 13px;
}

/* ---------- Reaction pills — copied identically from the Chat plugin ---------- */

.src-chat-reactions {
    display: flex;
    gap: 4px;
}

.src-chat-reaction-pill {
    font-size: 11px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    padding: 1px 7px;
    cursor: pointer;
}

.src-chat-reaction-mine {
    background: #eaf5fb;
    border-color: #3c96c6;
}

/* ---------- Quick emoji picker — copied identically from the Chat plugin ---------- */

#src-chat-quick-picker {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    padding: 6px 10px;
    display: flex;
    gap: 6px;
    z-index: 1000;
}

#src-chat-quick-picker span {
    cursor: pointer;
    font-size: 18px;
}

#src-chat-quick-picker span:hover {
    transform: scale(1.2);
}

/* ---------- Forward overlay ---------- */

#fact-forward-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fact-forward-box {
    background: #fff;
    border-radius: 12px;
    width: 320px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    padding: 14px;
}

#fact-forward-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    margin-bottom: 10px;
}

#fact-forward-close {
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
}

#fact-forward-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-bottom: 8px;
}

#fact-forward-results {
    overflow-y: auto;
}

.fact-forward-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
}

.fact-forward-user-row:hover {
    background: #f4f6f8;
}

.fact-forward-user-row img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ---------- Comments ---------- */

.fact-comment-toggle {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
}

.fact-comment-toggle:hover {
    opacity: 1;
}

.fact-comments {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.fact-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.fact-comments-title {
    font-size: 12px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fact-comments-close {
    border: none;
    background: #f0f0f0;
    color: #666;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.fact-comments-close:hover {
    background: #e2e2e2;
}

.fact-comments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.fact-comments-loading {
    font-size: 12px;
    color: #888;
}

.fact-comment {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.fact-comment-delete {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 11px;
    flex-shrink: 0;
    padding: 2px;
}

.fact-comment-delete:hover {
    color: #c0392b;
}

.fact-comment-avatar {
    width: 26px;
    height: 26px;
    max-width: 26px;
    max-height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.fact-comment-body {
    background: #f4f6f8;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
}

.fact-comment-author {
    font-size: 12px;
    font-weight: 700;
    color: #222;
}

.fact-comment-text {
    font-size: 13px;
    font-weight: 400;
    color: #444;
    word-wrap: break-word;
}

.fact-comment-time {
    font-size: 11px;
    font-weight: 400;
    color: #999;
    margin-top: 2px;
}

.fact-comment-composer {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fact-comment-emoji-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
}

.fact-comment-input {
    flex: 1;
    box-sizing: border-box;
    height: 22px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 18px;
    font-size: 12px;
}

.fact-comment-send-btn {
    border: none;
    background: #3c96c6;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.fact-comment-send-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ---------- Generic emoji-insert palette (comments) ---------- */

#src-chat-emoji-palette {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    z-index: 1000;
}

#src-chat-emoji-palette span {
    cursor: pointer;
    font-size: 18px;
    text-align: center;
    padding: 4px;
}

#src-chat-emoji-palette span:hover {
    background: #f4f6f8;
    border-radius: 6px;
}
