:root {
    --pc-nav-height: 60px;
    --pc-chat-width: min(420px, 92vw);
    --pc-chat-bg: #0b1320;
    --pc-chat-header-bg: #101a2a;
    --pc-chat-border: rgba(148, 163, 184, 0.24);
    --pc-chat-shadow: 0 18px 58px rgba(0, 0, 0, 0.5);
    --pc-chat-text: #f8fafc;
    --pc-chat-muted: #94a3b8;
    --pc-chat-button-bg: #17243a;
    --pc-chat-button-hover: #223454;
}

/*
 * Neutralize classes left behind by earlier dock experiments.
 */
.pc-live-chat-shell,
.pc-owncast-native-chat-hidden,
.pc-legacy-unified-chat-hidden,
.pc-hide-owncast-native-chat {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    flex: 0 0 0 !important;
    overflow: hidden !important;
}

/*
 * Drawer. It overlays the page instead of resizing Owncast.
 */
#pc-chat-dock-v4 {
    position: fixed;
    top: var(--pc-nav-height);
    right: 0;
    bottom: 0;
    z-index: 2147482000;

    display: flex;
    flex-direction: column;

    width: var(--pc-chat-width);
    min-width: 0;

    border-left: 1px solid var(--pc-chat-border);
    background: var(--pc-chat-bg);
    box-shadow: var(--pc-chat-shadow);

    transform: translateX(105%);
    transition: transform 180ms ease;
}

body.pc-chat-v4-open #pc-chat-dock-v4 {
    transform: translateX(0);
}

.pc-chat-v4__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    min-height: 50px;
    padding: 0 14px;

    border-bottom: 1px solid var(--pc-chat-border);
    background: var(--pc-chat-header-bg);
}

.pc-chat-v4__title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pc-chat-v4__title strong {
    color: var(--pc-chat-text);
    font: 700 15px/1.1 Arial, Helvetica, sans-serif;
}

.pc-chat-v4__title span {
    margin-top: 4px;
    color: var(--pc-chat-muted);
    font: 12px/1 Arial, Helvetica, sans-serif;
}

#pc-chat-close-v4 {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border: 1px solid var(--pc-chat-border);
    border-radius: 8px;

    background: transparent;
    color: var(--pc-chat-text);

    cursor: pointer;
    font: 700 19px/1 Arial, Helvetica, sans-serif;
}

#pc-chat-close-v4:hover,
#pc-chat-close-v4:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

#pc-chat-frame-v4 {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    border: 0;
    background: var(--pc-chat-bg);
}

/*
 * Open-chat button. Hidden while the drawer is open because the drawer
 * already includes an × close control.
 */
#pc-chat-toggle-v4 {
    position: fixed;
    right: 16px;
    bottom: 18px;
    z-index: 2147482500;

    min-width: 78px;
    min-height: 42px;
    padding: 0 15px;

    border: 1px solid var(--pc-chat-border);
    border-radius: 999px;

    background: var(--pc-chat-button-bg);
    color: var(--pc-chat-text);

    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);

    cursor: pointer;
    font: 700 14px/1 Arial, Helvetica, sans-serif;
}

#pc-chat-toggle-v4:hover,
#pc-chat-toggle-v4:focus-visible {
    background: var(--pc-chat-button-hover);
}

body.pc-chat-v4-open #pc-chat-toggle-v4 {
    display: none;
}

#pc-chat-backdrop-v4 {
    display: none;
}

/*
 * Tablet and narrow desktop: dim the underlying page while the drawer
 * is open, but leave the page at its full width.
 */
@media (max-width: 1199px) {
    body.pc-chat-v4-open #pc-chat-backdrop-v4 {
        position: fixed;
        inset: var(--pc-nav-height) 0 0 0;
        z-index: 2147481500;

        display: block;

        background: rgba(0, 0, 0, 0.42);
        backdrop-filter: blur(1px);
        -webkit-backdrop-filter: blur(1px);
    }
}

/*
 * Mobile: open upward as a bottom sheet.
 */
@media (max-width: 719px) {
    :root {
        --pc-nav-height: 56px;
    }

    #pc-chat-dock-v4 {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;

        width: 100vw;
        height: min(72dvh, 680px);

        border-top: 1px solid var(--pc-chat-border);
        border-left: 0;
        border-radius: 16px 16px 0 0;

        transform: translateY(105%);
    }

    body.pc-chat-v4-open #pc-chat-dock-v4 {
        transform: translateY(0);
    }

    #pc-chat-toggle-v4 {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom));
    }
}

/*
 * POOPCAT OWNCAST NATIVE SIDEBAR SUPPRESSOR V1
 *
 * The custom merged drawer replaces Owncast's native right-side chat
 * column. Collapse the original column so it cannot compress the video.
 */
.pc-owncast-native-sidebar-hidden {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    flex: 0 0 0 !important;
    overflow: hidden !important;
}
