/* HIDE Name Color button - aggressive CSS */
.btn-success,
button.btn-success,
.btn[style*="background"][style*="green"],
.btn[style*="background"][style*="#28a745"],
.btn[style*="background"][style*="#28A745"],
button[style*="green"],
#chatheader .btn-success,
#usercount ~ button,
#usercount ~ .btn,
#usercount + button,
#usercount + .btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -99999px !important;
    pointer-events: none !important;
}

/* Global scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 3px;
    border: 0px solid hsl(0,0%,27%);
    border-top: 0;
    border-bottom: 0;
    display: none;
}

::-webkit-scrollbar-corner {
    background-color: rgba(26,26,26,1);
}

::-webkit-scrollbar-track {
    border-radius: 4px;
    background: var(--primarycolor);
}

::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #686868;
}

::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

* {
    font-size: 102%;
    font-family: "Quicksand", "Ubuntu", Verdana, Tahoma, sans-serif;
}

#wrap { padding: 0; }
/* Hide ALL resize-related elements from Cytube and jQuery UI */
#drinkbarwrap, #resizewrap, #videoResize, .column-resize, .ui-resizable-handle,
.resize-handle, .resizer, .gutter, .splitter, #sizerbar, #column-resize-handle,
[class*="resize"]:not(body):not(html), [id*="resize"]:not(#chatline),
[class*="Resize"], [id*="Resize"], [class*="splitter"], [class*="gutter"] {
    display: none !important;
    width: 0 !important;
    max-width: 0 !important;
    min-width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

#chatwrap > .profile-box {
    height: 100vh !important;
    width: 100vw !important;
    z-index: 1039 !important;
    max-height: unset;
    max-width: unset;
    position: fixed !important;
    top: 0px !important;
    left: 0px !important;
    padding: unset !important;
    overflow: visible;
    border: none;
}

.fluid > .profile-box {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%,-50%) !important;
    z-index: 1020;
}

div#chanjs-allow-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
}

#chanjs-allow-prompt > button.close { display: none; }
#mainpage { padding-top: 50px; }

.navbar { border: none; }

.navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form, .navbar-header {
    background: var(--primarycolor);
}

.navbar-inverse .navbar-brand { letter-spacing: 4px; }

.navbar-inverse .navbar-brand:focus, .navbar-inverse .navbar-brand:hover, .navbar-inverse .navbar-brand {
    color: #cee8ff;
}

.navbar-brand {
    float: left;
    padding: 15px;
    font-size: 18px;
    line-height: 20px;
    height: 50px;
}

.nav .open > a, .nav .open > a:focus, .nav .open > a:hover {
    background-color: var(--tertiarycolor) !important;
}

.navbar-nav>li:hover { background-image: var(--tertiarycolor) !important; }
.nav > li > a:focus, .nav > li > a:hover { background-color: var(--tertiarycolor) !important; }

#content-wrap { display: grid; }

#leftcontent {
    width: var(--leftcontentvw);
    background-image: var(--bgimageurl);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

#pollwrap { position: absolute; }

.poll-menu {
    position: absolute;
    z-index: 1020;
    max-width: 30%;
    background: rgba(0, 0, 0, 0.6);
    border: #bbbbbb;
    border-style: solid;
    border-width: thin;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(3.8px);
    -webkit-backdrop-filter: blur(3.8px);
}

.well.active { position: absolute; z-index: 1020; }

#video-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-content: center;
    height: calc(100vh - 50px);
    background-color: black;
}

#videowrap { width: 100%; padding: 0; }
div.embed-responsive * { max-height: calc(100vh - 50px); }

#motdwrap {
    background: rgba(28, 30, 34, 0.75);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4.8px);
    -webkit-backdrop-filter: blur(4.8px);
    border: 1px solid rgba(28, 30, 34, 0.34);
}

#motdrow { padding-top: 15px; }
.row { margin-left: 60px; margin-right: 50px; }
#announcements { height: 0; margin-top: 15px; }
#controlsrow { margin-left: 75px; }

#rightcontrols {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    width: 99% !important;
}

#playlistrow { margin-left: initial; }
#playlistrow ::before { display: initial; }
#rightpane { width: var(--leftcontentvw); }

#rightcontent {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    width: calc(100vw - var(--leftcontentvw));
    min-width: 273px;
    position: fixed;
    right: 0;
}

#chatheader { background-color: var(--primarycolor); border-radius: unset; }
#chatheader .label { height: unset; }
.currenttitlewrap { overflow: hidden; }

#videowrap-header {
    display: flex;
    overflow-wrap: break-word;
    overflow-y: auto;
    background-color: var(--secondarycolor);
    padding: 9px 15px 15px 15px;
    border-radius: 0;
}

#currenttitle { overflow-x: hidden; overflow-y: scroll; max-height: 40px; }
#usercount { padding-left: 20px; pointer-events: none; }

#userlist {
    height: 30px !important;
    min-height: 30px;
    width: inherit;
    min-width: inherit;
    float: unset;
    display: flex;
    overflow-x: scroll;
    overflow-y: hidden;
    background-color: var(--primarycolor);
}

#userlist::-webkit-scrollbar { display: block; }
#userlist, #messagebuffer, #chatheader, #videowrap-header { border: initial; }
.userlist_item { display: flex; padding-left: 15px; padding-top: 3px; }
.userlist_owner { font-size: small; }

#messagebuffer {
    height: unset !important;
    flex-grow: 1;
    padding-left: 10px;
    padding-right: 10px;
    background-color: var(--secondarycolor);
}

#messagebuffer > div {
    position: relative;
    border-radius: 0.25rem;
    padding: 0.15rem 0.3rem;
    padding-right: 4rem;
    margin-bottom: 4px;
}

#messagebuffer > div:last-child { padding-bottom: 0; margin-bottom: 0.5rem; }
.server-whisper { padding-left: 100px; padding-bottom: 0px; }
.server-msg-disconnect, .server-msg-reconnect { padding-bottom: 0px !important; border-radius: 6px; }
.label { display: flex; }
.username { display: flex; }

/* Hide original username when styled-username exists (fixes duplicate username issue) */
/* Using :has() for instant CSS-only detection without waiting for JS */
#messagebuffer > div:has(.styled-username) > .username,
#messagebuffer > div:has(.styled-username) .username {
    display: none !important;
}

.timestamp {
    position: absolute;
    top: 0.15rem;
    right: 0.3rem;
    color: rgb(120, 120, 120);
    font-size: 11px;
    visibility: visible;
}

.channel-emote { height: 80px; max-width: 200px; object-fit: contain; }
.emote-big { max-width: 120px; max-height: 120px; }
.emote-big > img { max-width: -webkit-fill-available; max-height: -webkit-fill-available; }
.nick-highlight { border-radius: 8px; }
#rightcontent > form { background-color: var(--primarycolor); }

#chatline {
    height: 3.6rem;
    max-height: 10rem;
    margin: 10px 0;
    border-radius: 10px;
    resize: none;
}

#chatline::placeholder { font-style: italic; opacity: .5; color: grey; }
.form-control { border: initial; border-radius: 8px; }

#leftcontrols {
    background-color: var(--primarycolor);
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    padding: 6px 8px;
    height: auto;
    min-height: 36px;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
}

#leftcontrols::-webkit-scrollbar {
    display: block !important;
    height: 6px !important;
}

/* Ensure form allows full width buttons */
#rightcontent > form {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

#leftcontrols::-webkit-scrollbar-thumb {
    background: var(--tertiarycolor);
    border-radius: 2px;
}

#leftcontrols .btn {
    flex: 0 0 auto;
    margin: 0;
    padding: 5px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.btn { background-image: none; background-color: var(--tertiarycolor); }
.btn:hover { filter: brightness(0.5); }
.btn-danger { color: #fff; background-color: #ee5f5b; }
.btn-danger:hover { filter: brightness(0.5); }
#jump-btn { color: white; }
#newpollbtn { display: flex; justify-content: center; align-items: center; }
#emotes-btn { display: flex; justify-content: center; align-items: center; }
#favorites-btn { display: flex; justify-content: center; align-items: center; }
#font-tags-btn { display: flex; justify-content: center; align-items: center; }
/* #afk-btn lives in overflow menu now */

#needpw { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); }
#needpw input { background-color: var(--secondarycolor) !important; }

.container .credit { margin: 10px 0; text-align: center; }
.text-muted { color: #7a8288; }
#footer { font-size: 11px; }

@media only screen and (max-width: 1264px) {
    #leftcontent { width: calc(100vw - 273px); }
}

@media only screen and (max-width: 768px) {
    /* === Fullscreen mobile layout: video fills the viewport, chat moves to a slide-up drawer === */

    /* Body resets to allow fixed/full-bleed video */
    html, body { overflow: hidden !important; height: 100% !important; }
    #wrap, #channel-content, #content-wrap, .container, .container-fluid { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }

    /* Hide non-essential chrome */
    #nav-collapsible, #motdrow, #announcements, .navbar, #pollwrap,
    #currenttitlewrap, #videowrap-header, #playlistrow, #controlsrow,
    #leftcontrols, #rightcontrols, #userlist, #userlisttoggle, #usercount,
    #chatheader, #footer, #sitefooter, .banner-slideshow,
    #pluginstuff, #drinkbar, #plcontrol, #playlistmanager,
    #queue, #queuefail, #playlist_controls, #leftpane-inner > *:not(#videowrap) {
        display: none !important;
    }

    /* Layout containers: full viewport */
    #leftcontent, #rightcontent, #leftpane, #leftpane-inner, #videowrap, #video-container, #ytapiplayer, #ytapiplayer iframe, #videowrap > div {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    /* Override Bootstrap's .embed-responsive (16:9 aspect-ratio wrapper) which
       would otherwise constrain the video to a vertically-centered strip. */
    #video-container .embed-responsive,
    .embed-responsive,
    .embed-responsive-16by9,
    .embed-responsive-4by3 {
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        width: 100vw !important;
        padding: 0 !important;
        padding-bottom: 0 !important;
        overflow: hidden;
    }
    .embed-responsive > *,
    .embed-responsive-item,
    div.embed-responsive * {
        max-height: none !important;
        max-width: none !important;
    }
    #leftcontent {
        position: fixed !important;
        top: 0; left: 0;
        width: 100vw !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 1;
    }
    #videowrap {
        padding: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        background: #000;
        display: block !important;
    }
    #video-container {
        display: block !important;
        position: relative !important;
        width: 100vw !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        max-height: none !important;
        z-index: 1;
        aspect-ratio: auto !important;
        flex: none !important;
    }
    #ytapiplayer {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        top: 0 !important;
        left: 0 !important;
    }
    #ytapiplayer iframe,
    #ytapiplayer video,
    #ytapiplayer object,
    #ytapiplayer embed,
    #videowrap iframe,
    #videowrap video,
    .embed-responsive iframe,
    .embed-responsive video,
    .embed-responsive-item {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        display: block !important;
        border: 0 !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
    }
    #videowrap video {
        object-fit: contain;
        background: #000;
    }

    /* Right content (chat) is hidden by default — opened via drawer */
    #rightcontent {
        position: fixed !important;
        bottom: 0; left: 0; right: 0;
        width: 100vw !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 9998;
        background: rgba(0, 0, 0, 0.92);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        transform: translateY(100%);
        transition: transform 0.3s ease, height 0.3s ease;
        overflow: hidden;
        pointer-events: none;
        display: flex;
        flex-direction: column;
    }
    body.mobile-chat-open #rightcontent {
        height: 70vh !important;
        height: calc(var(--vh, 1vh) * 70) !important;
        transform: translateY(0);
        pointer-events: auto;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6);
        border-top: 2px solid var(--tertiarycolor, #8F6409);
    }
    body.mobile-chat-open #messagebuffer {
        flex: 1 1 auto;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        overflow-y: auto;
        padding: 8px 10px;
        box-sizing: border-box;
    }
    body.mobile-chat-open #formline {
        flex: 0 0 auto;
        width: 100% !important;
        padding: 6px 8px;
        box-sizing: border-box;
        background: rgba(0, 0, 0, 0.5);
    }
    body.mobile-chat-open #chatline {
        width: 100% !important;
    }

    /* === Floating chat toggle button (always visible on mobile) === */
    #mobile-chat-toggle {
        position: fixed;
        right: 14px;
        bottom: 14px;
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: var(--tertiarycolor, #8F6409);
        color: #fff;
        border: 2px solid rgba(255, 255, 255, 0.25);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
        font-size: 26px;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.2s ease, background 0.2s ease;
    }
    #mobile-chat-toggle:active { transform: scale(0.92); }
    body.mobile-chat-open #mobile-chat-toggle {
        bottom: calc(70vh + 10px);
        bottom: calc(var(--vh, 1vh) * 70 + 10px);
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    #mobile-chat-toggle .mobile-chat-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        background: #e74c3c;
        color: #fff;
        font-size: 11px;
        font-weight: bold;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 10px;
        display: none;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        border: 2px solid #000;
    }
    #mobile-chat-toggle.has-unread .mobile-chat-badge { display: flex; }
    body.mobile-chat-open #mobile-chat-toggle .mobile-chat-icon-open { display: none; }
    body:not(.mobile-chat-open) #mobile-chat-toggle .mobile-chat-icon-close { display: none; }

    /* === Auto-hide: fade toggle + input bar after inactivity === */
    #mobile-chat-toggle, #mobile-quick-input {
        transition: opacity 0.5s ease, transform 0.2s ease;
    }
    body.mobile-ui-idle:not(.mobile-chat-open) #mobile-chat-toggle,
    body.mobile-ui-idle:not(.mobile-chat-open) #mobile-quick-input {
        opacity: 0;
        pointer-events: none;
    }

    /* === Persistent indicator (tiny dot, visible only when UI is idle) === */
    #mobile-ui-indicator {
        position: fixed;
        top: 14px;
        right: 14px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
        z-index: 10000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.4s ease;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    /* Expand the tappable area without enlarging the visible dot */
    #mobile-ui-indicator::after {
        content: '';
        position: absolute;
        top: -16px; right: -16px; bottom: -16px; left: -16px;
    }
    body.mobile-ui-idle:not(.mobile-chat-open) #mobile-ui-indicator {
        opacity: 0.7;
        pointer-events: auto;
    }

    /* === Recent messages overlay (Twitch-style) === */
    #mobile-chat-overlay {
        position: fixed;
        left: 0;
        right: 70px; /* leave room for the toggle button */
        bottom: 70px; /* sit above the compact input bar */
        max-height: 40vh;
        z-index: 9997;
        pointer-events: none;
        padding: 4px 10px;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        gap: 4px;
        overflow: hidden;
    }
    #mobile-chat-overlay .mobile-overlay-msg {
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        color: #fff;
        padding: 6px 10px;
        border-radius: 12px;
        font-size: 13px;
        line-height: 1.35;
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        animation: mobileOverlayFadeIn 0.25s ease;
        text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    }
    #mobile-chat-overlay .mobile-overlay-msg.fading {
        animation: mobileOverlayFadeOut 0.5s ease forwards;
    }
    #mobile-chat-overlay .mobile-overlay-msg .username {
        font-weight: bold;
        margin-right: 4px;
        display: inline !important;
    }
    #mobile-chat-overlay .mobile-overlay-msg img {
        max-height: 28px;
        vertical-align: middle;
    }
    body.mobile-chat-open #mobile-chat-overlay { display: none; }

    @keyframes mobileOverlayFadeIn {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
    @keyframes mobileOverlayFadeOut {
        to { opacity: 0; transform: translateY(-4px); }
    }

    /* === Compact input bar (always visible at bottom) === */
    #mobile-quick-input {
        position: fixed;
        left: 10px;
        right: 80px; /* leave room for toggle button */
        bottom: 14px;
        height: 44px;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border-radius: 22px;
        display: flex;
        align-items: center;
        padding: 0 6px 0 14px;
        z-index: 9997;
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    #mobile-quick-input input {
        flex: 1;
        background: transparent;
        border: none;
        outline: none;
        color: #fff;
        font-size: 14px;
        height: 100%;
        padding: 0;
    }
    #mobile-quick-input input::placeholder { color: rgba(255, 255, 255, 0.5); }
    #mobile-quick-input button {
        background: var(--tertiarycolor, #8F6409);
        color: #fff;
        border: none;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        margin-left: 6px;
        font-size: 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    body.mobile-chat-open #mobile-quick-input { display: none; }

    /* Adjust popups for mobile (emote panel, style settings, etc.) */
    .emote-panel { width: 90vw !important; max-width: 90vw !important; left: 5vw !important; }
    .favorites-dropdown { max-width: 90vw !important; }

    /* Make popups smaller and centered */
    #emote-popup, #style-settings-popup, #drawing-settings-popup,
    #impersonate-popup {
        max-width: 95vw !important;
        max-height: 85vh !important;
    }
}

/* === Desktop: ensure mobile-only elements are hidden === */
@media only screen and (min-width: 769px) {
    #mobile-chat-toggle,
    #mobile-chat-overlay,
    #mobile-quick-input,
    #mobile-ui-indicator { display: none !important; }
}

.modal-body::before {
    content: "";
    background-image: var(--dialogbgimageurl);
    background-size: contain;
    background-repeat: no-repeat;
    background-position-y: bottom;
    position: absolute;
    top: 0px; right: 0px; bottom: 0px; left: 0px;
    opacity: 0.5;
}

.modal-backdrop.in { opacity: .3; }
.tab-content > .tab-pane, .form-group, .pm-history-content { position: relative; }
textarea.form-control { height: 500px; }
.nick-hover { background-color: rgba(0, 0, 0, 0); }

.banner-slideshow {
    height: 215px;
    max-width: 100%;
    margin: 0 auto;
    border-style: solid;
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
    border-color: #916907;
}

.banner-slideshow > div {
    height: 400px;
    width: 5066px;
    background: var(--bannerimg);
    background-size: 50%;
    background-position: center;
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    transform: translate3d(0, 0, 0);
}

.banner-slideshow .mover-1 { animation: moveSlideshow 20s linear infinite; }
@keyframes moveSlideshow { 100% { transform: translateX(-50%); } }

.autocomplete-items {
    position: absolute;
    max-height: 150px;
    overflow: scroll;
    border: 1px solid #d4d4d4;
    border-left: none; border-right: none; border-bottom: none;
    z-index: 99;
    bottom: 100px; left: 0; right: 0;
    background: rgba(0, 0, 0, 0.67);
    border-style: none;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(7.8px);
    -webkit-backdrop-filter: blur(7.8px);
}

.autocomplete-items div {
    display: flex;
    align-items: center;
    padding: 0 10px;
    cursor: pointer;
    background: transparent;
    border: none;
}

.autocomplete-items div:hover { background-color: #4a4a4a; }
#autocomplete-image { margin-left: auto; display: block; height: 42px; }
.autocomplete-active { background-color: var(--tertiarycolor) !important; color: #ffffff; }

.reply {
    position: relative;
    background-color: var(--tertiarycolor);
    padding: 0.5rem;
    padding-top: 0;
    margin-bottom: 0.4rem;
    border: gray 1px solid;
    border-radius: 1rem 1rem 1rem 0;
    overflow: hidden;
    max-height: 10rem;
    width: 98%;
    transition-property: background-color;
    transition-timing-function: cubic-bezier(.4,0,.2,1);
    transition-duration: 75ms;
    cursor: pointer;
}

.reply:hover { background-color: var(--secondarycolor); }
.reply:hover::after { background-image: unset; }

.reply::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1rem;
    background-image: linear-gradient(to bottom, transparent, var(--tertiarycolor));
}

.reply-header { font-size: small; }

.reply-msg {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-size: small;
    color: white;
}

.reply-button {
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0; right: 0;
    height: 2.5rem;
    width: 2.5rem;
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 10000px;
    transition-property: background-color;
    transition-timing-function: cubic-bezier(.4,0,.2,1);
    transition-duration: 75ms;
}

.reply-button:hover { background-color: var(--tertiarycolor); }
#messagebuffer > div:hover .reply-button { visibility: visible; }
#messagebuffer > div:not(:has(> .server-whisper)):hover .timestamp { visibility: hidden; }

.reply-icon {
    display: block;
    height: 2.5rem;
    width: 2.5rem;
    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCI+PHBhdGggZD0iTTIwIDE4di04TDYgMjRsMTQgMTR2LTguMmMxMCAwIDE3IDMuMiAyMiAxMC4yLTItMTAtOC0yMC0yMi0yMnoiIGZpbGw9IiNjMmMyYzIiLz48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDQ4djQ4SDB6Ii8+PC9zdmc+);
    background-size: 2.5rem 2.5rem;
    pointer-events: none;
}

/* ========== FLOATING EMOTE PANEL ========== */
.emote-panel {
    position: fixed;
    z-index: 2000;
    width: 400px;
    max-width: 90vw;
    height: 450px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

.emote-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--primarycolor);
    cursor: move;
    user-select: none;
}

.emote-panel-title { font-weight: bold; color: white; font-size: 14px; }
.emote-panel-controls { display: flex; gap: 8px; }

.emote-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.emote-panel-close:hover { background-color: rgba(255, 255, 255, 0.1); }

.emote-panel-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    gap: 5px;
}

.emote-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
}

.emote-tab:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.emote-tab.active { background: var(--tertiarycolor); color: white; }

.emote-panel-search { padding: 8px 10px; background: rgba(0, 0, 0, 0.2); }

.emote-panel-search input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 13px;
}

.emote-panel-search input::placeholder { color: #888; }
.emote-panel-search input:focus { outline: none; border-color: var(--tertiarycolor); }

.emote-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 5px;
}

.emote-panel-body::-webkit-scrollbar { width: 8px; display: block; }
.emote-panel-body::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
.emote-panel-body::-webkit-scrollbar-thumb { background: var(--tertiarycolor); border-radius: 4px; }

.emote-panel-empty {
    width: 100%;
    text-align: center;
    color: #888;
    padding: 40px 20px;
    font-size: 14px;
}

.emote-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.emote-item:hover { background: rgba(255, 255, 255, 0.15); transform: scale(1.05); }
.emote-item img { max-width: 50px; max-height: 50px; object-fit: contain; }

.emote-fav-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    padding: 0;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.emote-item:hover .emote-fav-btn { opacity: 1; }
.emote-fav-btn:hover { transform: scale(1.2); }
.emote-fav-btn.favorited { color: #FFD700; background: rgba(255, 215, 0, 0.2); opacity: 1; }

/* ========== FAVORITES DROPDOWN ========== */
.favorites-dropdown {
    position: fixed;
    z-index: 2001;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    max-width: 320px;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(30, 30, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.favorites-dropdown::-webkit-scrollbar { width: 6px; display: block; }
.favorites-dropdown::-webkit-scrollbar-thumb { background: var(--tertiarycolor); border-radius: 3px; }

.favorites-dropdown img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    cursor: pointer;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.2s;
}

.favorites-dropdown img:hover { background: rgba(255, 255, 255, 0.15); transform: scale(1.1); }

.favorites-empty {
    color: #888;
    font-size: 13px;
    padding: 10px;
    text-align: center;
    width: 100%;
}

/* ========== FONT TAGS PANEL ========== */
.font-tags-panel {
    position: fixed;
    z-index: 2000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.font-tags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--primarycolor);
    color: white;
    font-weight: bold;
}

.font-tags-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.font-tags-close:hover { background: rgba(255, 255, 255, 0.1); }

.font-tags-info {
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    font-size: 12px;
    color: #ccc;
}

.font-tags-info p { margin: 0 0 8px 0; }
.font-tags-info p:last-child { margin-bottom: 0; }
.font-tags-info code { background: rgba(255, 255, 255, 0.1); padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.font-tags-note { color: #ffcc00 !important; }
.font-tags-note a { color: #5dadec; text-decoration: underline; }

.font-tags-section { padding: 12px 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.font-tags-section:last-child { border-bottom: none; }
.font-tags-section h4 { margin: 0 0 10px 0; color: #aaa; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.font-tags-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.font-tag-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.font-tag-btn:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.05); }

.font-tag-btn.active {
    background: rgba(255, 215, 0, 0.3) !important;
    border-color: #FFD700 !important;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.style-preview-box {
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.reset-style-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 100, 100, 0.2);
    border: 1px solid rgba(255, 100, 100, 0.4);
    border-radius: 8px;
    color: #ff8888;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-style-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.6);
    color: #ffaaaa;
}

.font-tags-example {
    display: block;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    color: #5dadec;
    font-size: 13px;
}

/* ========== FILTER INSTRUCTIONS MODAL ========== */
.filter-instructions-modal {
    position: fixed;
    z-index: 3000;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.filter-instructions-content {
    background: rgba(30, 30, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.filter-instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primarycolor);
}

.filter-instructions-header h2 { margin: 0; color: white; font-size: 18px; }

.filter-instructions-header button {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.filter-instructions-header button:hover { background: rgba(255, 255, 255, 0.1); }

.filter-instructions-body {
    padding: 20px;
    overflow-y: auto;
    color: #ddd;
    font-size: 14px;
    line-height: 1.6;
}

.filter-instructions-body p { margin: 0 0 15px 0; }
.filter-instructions-body ol { margin: 0 0 20px 0; padding-left: 20px; }
.filter-instructions-body li { margin-bottom: 8px; }

.filter-list { overflow-x: auto; margin: 15px 0; }
.filter-list table { width: 100%; border-collapse: collapse; font-size: 12px; }
.filter-list th, .filter-list td { padding: 8px 10px; text-align: left; border: 1px solid rgba(255, 255, 255, 0.2); }
.filter-list th { background: var(--primarycolor); color: white; font-weight: bold; }
.filter-list td { background: rgba(0, 0, 0, 0.2); font-family: monospace; font-size: 11px; word-break: break-all; }
.filter-list tr:hover td { background: rgba(255, 255, 255, 0.05); }

.filter-note {
    background: rgba(93, 173, 236, 0.1);
    border: 1px solid rgba(93, 173, 236, 0.3);
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
}

.filter-note code { background: rgba(255, 255, 255, 0.1); padding: 2px 6px; border-radius: 4px; }

/* ========== TEXT STYLING EFFECTS FOR CHAT ========== */

/* Gradient text styles */
.text-rainbow {
    background: linear-gradient(90deg, #ff0000, #ff7700, #ffff00, #00ff00, #0077ff, #8b00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-fire {
    background: linear-gradient(90deg, #ff0000, #ff5500, #ffaa00, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-ocean {
    background: linear-gradient(90deg, #00ffff, #0088ff, #0044aa, #002255);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-sunset {
    background: linear-gradient(90deg, #ff6b6b, #ffa500, #ffdb58, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-neon {
    background: linear-gradient(90deg, #ff00ff, #00ffff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-forest {
    background: linear-gradient(90deg, #228b22, #32cd32, #90ee90, #006400);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-gold {
    background: linear-gradient(90deg, #ffd700, #ffec8b, #daa520, #b8860b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-ice {
    background: linear-gradient(90deg, #e0ffff, #87ceeb, #add8e6, #b0e0e6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glow effects */
.text-glow-white { text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff; }
.text-glow-red { text-shadow: 0 0 10px #f00, 0 0 20px #f00, 0 0 30px #f00; color: #ff6666; }
.text-glow-blue { text-shadow: 0 0 10px #00f, 0 0 20px #00f, 0 0 30px #0ff; color: #6666ff; }
.text-glow-green { text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 30px #0f0; color: #66ff66; }
.text-glow-gold { text-shadow: 0 0 10px #ffd700, 0 0 20px #ffa500, 0 0 30px #ff8c00; color: #ffd700; }
.text-glow-pink { text-shadow: 0 0 10px #ff69b4, 0 0 20px #ff1493, 0 0 30px #ff69b4; color: #ff69b4; }
.text-glow-rainbow { text-shadow: 0 0 5px #f00, 0 0 10px #ff0, 0 0 15px #0f0, 0 0 20px #0ff, 0 0 25px #00f, 0 0 30px #f0f; }

/* Animation effects - fallback definitions (also in script.js injected <style> with !important) */
.text-shake { animation: shake 0.5s ease-in-out infinite; display: inline-block; }
.text-pulse { animation: pulse 1s ease-in-out infinite; display: inline-block; }
.text-bounce { animation: bounce 0.6s ease infinite; display: inline-block; }
.text-wave { animation: wave 2s ease-in-out infinite; display: inline-block; }
.text-flicker { animation: flicker 0.3s ease-in-out infinite; display: inline-block; }
.text-spin { animation: spin 2s linear infinite; display: inline-block; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
@keyframes wave {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(-2deg); }
    75% { transform: translateY(3px) rotate(2deg); }
}
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== ENHANCED RESPONSIVE BREAKPOINTS ========== */

/* Ultra-wide and 4K monitors (2560px+) */
@media (min-width: 2560px) {
    #content-wrap {
        max-width: 3400px;
        margin: 0 auto;
    }
    #rightcontent {
        min-width: 350px;
    }
    .channel-emote {
        height: 100px;
        max-width: 250px;
    }
    #messagebuffer > div {
        padding: 0.2rem 0.4rem;
        margin-bottom: 5px;
    }
    .emote-panel {
        width: 500px;
    }
}

/* Large desktop monitors (1920-2559px) */
@media (min-width: 1920px) and (max-width: 2559px) {
    #rightcontent {
        min-width: 320px;
    }
}

/* Small laptops (1024-1264px) */
@media (min-width: 1024px) and (max-width: 1264px) {
    #leftcontent {
        width: 70% !important;
    }
    #rightcontent {
        width: 30% !important;
        min-width: 290px;
    }
    #leftcontrols .btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    .emote-panel {
        width: 350px;
    }
}

/* Large tablets landscape (769-1023px) */
@media (min-width: 769px) and (max-width: 1023px) {
    #leftcontent {
        width: 62% !important;
    }
    #rightcontent {
        width: 38% !important;
        min-width: 280px;
    }
    #leftcontrols .btn {
        padding: 4px 6px;
        font-size: 11px;
    }
    .channel-emote {
        height: 60px;
        max-width: 150px;
    }
}

/* Ultra-wide monitor handling (21:9 and wider) */
@media (min-aspect-ratio: 21/9) {
    #leftcontent {
        width: 72% !important;
    }
    #rightcontent {
        width: 28% !important;
        min-width: 380px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Aspect ratio container for video (modern browsers) - desktop only.
   Mobile uses fullscreen video, see the mobile media query above. */
