/* Chrome 어둑시니 배회 메시지 — 페이지·테마 CSS와 분리 (#darkthread-status-bar) */

#darkthread-status-bar.status-bar--chrome-presence {
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

#darkthread-status-bar.status-bar--chrome-presence:has([data-darkthread-presence-message][hidden]) {
    height: 0;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: none;
}

#darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden])) {
    border-bottom: 1px solid var(--dt-chrome-presence-border, rgba(255, 255, 255, 0.07));
}

#darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden]))
    + #darkthread-chrome-subbars #darkthread-search-bar.search-bar--v2-chrome {
    margin-top: 0;
    border-top: none;
}

#darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden]))
    + #darkthread-chrome-subbars .category-context-strip {
    margin-top: 0;
    border-top: none;
}

.darkthread-chrome-presence {
    --dt-chrome-presence-text: rgba(148, 163, 184, 0.86);
    --dt-chrome-presence-count: rgba(248, 113, 113, 0.95);
    --dt-chrome-presence-border: rgba(255, 255, 255, 0.07);
    --dt-chrome-presence-drawer-separator: rgba(255, 255, 255, 0.16);
    --dt-chrome-presence-drawer-shadow: 0 -8px 18px rgba(0, 0, 0, 0.34);
    --dt-chrome-presence-bg: rgba(13, 15, 18, 0.94);
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0;
    background: var(--dt-chrome-presence-bg);
    color: var(--dt-chrome-presence-text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    isolation: isolate;
}

html.darkthread-board-list-v2-theme-light .darkthread-chrome-presence,
body.darkthread-board-list-v2-theme-light .darkthread-chrome-presence {
    --dt-chrome-presence-text: #475569;
    --dt-chrome-presence-count: #b91c1c;
    --dt-chrome-presence-border: rgba(148, 163, 184, 0.22);
    --dt-chrome-presence-drawer-separator: rgba(100, 116, 139, 0.3);
    --dt-chrome-presence-drawer-shadow: 0 -8px 18px rgba(15, 23, 42, 0.08);
    --dt-chrome-presence-bg: rgba(248, 250, 252, 0.96);
}

.darkthread-chrome-presence__message {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.darkthread-chrome-presence__message[hidden] {
    display: none !important;
}

.darkthread-chrome-presence__text {
    margin: 0;
    padding: 0.5rem clamp(12px, 3vw, 1.05rem);
    text-align: center;
    font-size: clamp(0.84rem, 1.05vw, 0.95rem);
    font-weight: 500;
    line-height: 1.42;
    letter-spacing: 0.01em;
    color: var(--dt-chrome-presence-text);
}

.darkthread-chrome-presence [data-darkthread-presence-count] {
    color: var(--dt-chrome-presence-count);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* subbars·v2 테마 배경이 메시지 색/배경을 덮어쓰지 않도록 */
body.darkthread-board-list-v2-page.darkthread-board-list-v2-theme-dark
    #darkthread-status-bar.status-bar--chrome-presence .darkthread-chrome-presence,
body.darkthread-board-list-v2-page:not(.darkthread-board-list-v2-theme-light)
    #darkthread-status-bar.status-bar--chrome-presence .darkthread-chrome-presence {
    --dt-chrome-presence-bg: rgba(13, 15, 18, 0.96);
    --dt-chrome-presence-border: rgba(255, 255, 255, 0.055);
}

body.darkthread-board-list-v2-page.darkthread-board-list-v2-theme-light
    #darkthread-status-bar.status-bar--chrome-presence .darkthread-chrome-presence,
html.darkthread-board-list-v2-theme-light
    #darkthread-status-bar.status-bar--chrome-presence .darkthread-chrome-presence {
    --dt-chrome-presence-bg: rgba(255, 255, 255, 0.98);
    --dt-chrome-presence-text: #475569;
    --dt-chrome-presence-count: #b91c1c;
    --dt-chrome-presence-border: rgba(148, 163, 184, 0.2);
    --dt-chrome-presence-drawer-separator: rgba(100, 116, 139, 0.3);
    --dt-chrome-presence-drawer-shadow: 0 -8px 18px rgba(15, 23, 42, 0.08);
}

body.darkthread-has-mobile-tab-bar:has(
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden]))
    )
    #darkthread-chrome-subbars {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

@media (max-width: 999px) {
    body.darkthread-has-mobile-category-strip
        #darkthread-status-bar.status-bar--chrome-presence:has([data-darkthread-presence-message][hidden]) {
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    body.darkthread-has-mobile-category-strip
        #darkthread-status-bar.status-bar--chrome-presence:has(
            + #darkthread-chrome-subbars .category-context-strip
        ):not(:has([data-darkthread-presence-message][hidden])) {
        margin-bottom: 0;
        border-bottom: none;
    }

    body.darkthread-has-mobile-category-strip
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden]))
        .darkthread-chrome-presence {
        background: rgba(3, 3, 3, 0.85);
    }

    body.darkthread-has-mobile-category-strip.darkthread-board-list-v2-theme-light
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden]))
        .darkthread-chrome-presence {
        background: rgba(255, 255, 255, 0.92);
    }
}

/* 모바일 하단 탭: 배회 메시지를 탭 바로 바로 위에 고정 (header.css의 display:none 덮어씀) */
@media (max-width: 1079px) {
    body.darkthread-has-mobile-tab-bar
        #darkthread-status-bar.status-bar--chrome-presence:not(.status-bar--promo-active):not(
            :has([data-darkthread-presence-message][hidden])
        ) {
        display: block !important;
        position: fixed;
        right: 0;
        bottom: var(--darkthread-mobile-tab-bar-inset, calc(4.55rem + env(safe-area-inset-bottom, 0px)));
        left: 0;
        z-index: 54;
        width: 100%;
        max-width: 100vw;
        margin: 0;
        padding: 0;
        border-bottom: none;
        border-top: 1px solid var(--dt-chrome-presence-border, rgba(255, 255, 255, 0.07));
        box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.4);
        transform: translateZ(0);
    }

    /* 드로어 열림 시 하단 메시지바가 드로어와 붙어 보이지 않도록 얇은 분리감을 유지 */
    body.darkthread-has-mobile-tab-bar.darkthread-notification-open
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden])),
    body.darkthread-has-mobile-tab-bar.darkthread-profile-open
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden])),
    body.darkthread-has-mobile-tab-bar.darkthread-settings-open
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden])),
    body.darkthread-has-mobile-tab-bar.darkthread-nav-drawer-open
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden])),
    body.darkthread-has-mobile-tab-bar:has(.is-category-panel-open)
        #darkthread-status-bar.status-bar--chrome-presence:not(:has([data-darkthread-presence-message][hidden])) {
        border-top-color: var(--dt-chrome-presence-drawer-separator, rgba(255, 255, 255, 0.16));
        box-shadow: var(--dt-chrome-presence-drawer-shadow, 0 -8px 18px rgba(0, 0, 0, 0.34));
    }
}
