/* ============================================================
   Room video — a small window that floats over the chat panel
   for good, and can be dragged anywhere. The chat panel keeps
   its normal size and position underneath.

   The window is 340×216 by default, drops above the bottom bar,
   and sits higher than the online list so it is never buried.
   ============================================================ */

#ugb_party {
    position: fixed;
    /* bottom left, just above the autoscroll notice that floats over the
       bottom-left corner of the chat (left:5px; bottom:60px) */
    left: 20px;
    bottom: 100px;
    width: 340px;
    height: 216px;
    background: #000;
    border: 2px solid #2a7f7f;
    border-radius: 8px;
    overflow: hidden;
    touch-action: none;
    z-index: 100002;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75);
}

/* until the visitor clicks it, the window says "click me" with its border */
#ugb_party.needs-sound {
    border-color: #7fd6d6;
    animation: ugb_party_pulse 1.8s ease-in-out infinite;
}

@keyframes ugb_party_pulse {
    0%, 100% {
        border-color: #2a7f7f;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), 0 0 0 0 rgba(127, 214, 214, 0.5);
    }
    50% {
        border-color: #9ff0f0;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), 0 0 16px 5px rgba(127, 214, 214, 0.55);
    }
}

@media (prefers-reduced-motion: reduce) {
    #ugb_party.needs-sound {
        animation: none;
    }
}

#ugb_party_bar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 26px;
    padding: 0 8px;
    background: #070b0d;
    border-bottom: 1px solid #143030;
    font-family: verdana, sans-serif;
    font-size: 9px;
    color: #9dbbbb;
    white-space: nowrap;
    overflow: hidden;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    /* without this a finger drag is treated as a page scroll and the browser
       fires pointercancel a few pixels in, which is what killed dragging on
       phones */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

#ugb_party_live {
    flex: 0 0 auto;
    color: #ff5555;
    font-weight: bold;
    letter-spacing: 0.5px;
}

#ugb_party_title {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #cfe6e6;
}

#ugb_party_state {
    flex: 0 0 auto;
    margin-left: auto;
    color: #6f8a8a;
}

.ugb_party_btn {
    flex: 0 0 auto;
    cursor: pointer;
    padding: 2px 6px;
    border: 1px solid #1d4444;
    border-radius: 4px;
    color: #b8d4d4;
    line-height: 14px;
}

.ugb_party_btn:hover {
    background: #123030;
    color: #fff;
}

#ugb_party_player {
    position: absolute;
    /* the whole window is a drag handle, so no part of it may hand the touch
       back to the page as a scroll */
    touch-action: none;
    top: 27px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
}

#ugb_party_play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding-left: 4px;
    box-sizing: border-box;
    border: 2px solid #7fd6d6;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #eaf7f7;
    font-family: verdana, sans-serif;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
}

#ugb_party_play:hover {
    background: rgba(20, 60, 60, 0.85);
    color: #fff;
}

#ugb_party_player video {
    touch-action: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* The file is cropped to the artwork itself, a 358×400 poster (the upload
       had a 1 px black sliver either side), so about 85 px shows down each
       side of this window (68 px on a phone). Those bars take the poster's own
       edge tones — #fcfffc on the left, #f9faf8 on the right, sampled from the
       file — faded a little darker towards the window edges, so the join
       continues the poster's paper background instead of framing it. The
       25%–75% span sits behind the picture. Retune these two colours if the
       video is swapped. */
    background: linear-gradient(90deg, #e4e5e2 0%, #fcfffc 25%, #f9faf8 75%, #eceeec 100%);
    object-fit: contain;
}

#ugb_party_notice {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    padding: 5px 8px;
    background: rgba(6, 12, 12, 0.92);
    border-top: 1px solid #1d4444;
    font-family: verdana, sans-serif;
    font-size: 9px;
    line-height: 14px;
    color: #cfe6e6;
    text-align: center;
}

#ugb_party_notice a,
#ugb_party_retry {
    color: #7fd6d6;
}

#ugb_party_retry {
    margin-left: 8px;
    cursor: pointer;
    text-decoration: underline;
}

/* while the picture runs without sound, say so over the picture itself: on a
   phone the bar is 240px wide and the wording there had to be dropped */
#ugb_party_prompt {
    position: absolute;
    left: 7px;
    bottom: 7px;
    display: block;
    padding: 4px 9px;
    border: 1px solid #7fd6d6;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    font-family: verdana, sans-serif;
    font-size: 9px;
    line-height: 14px;
    color: #eaf7f7;
    white-space: nowrap;
    /* a hint, not a control: the press falls through to the window, which is
       what brings the sound up and what drags it */
    pointer-events: none;
    z-index: 2;
}

/* right click the window for the numbers behind the picture */
#ugb_party_stats {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: none;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.84);
    font-family: "Courier New", courier, monospace;
    font-size: 9px;
    line-height: 13px;
    text-align: left;
    z-index: 4;
    /* a readout, not a control: presses fall through to the window, so a
       second right click still puts the panel away */
    pointer-events: none;
}

#ugb_party_stats i {
    float: left;
    clear: left;
    width: 62px;
    font-style: normal;
    color: #7fa8a8;
}

#ugb_party_stats span {
    display: block;
    margin-left: 62px;
    color: #eaf7f7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    #ugb_party {
        width: 240px;
        height: 152px;
        left: 8px;
        bottom: 52px;
    }

    /* the phone bar shows the show's name instead of the timecode/sync
       readout: the name is what tells you what you are looking at, and
       nothing depends on the readout (the stats panel still has the
       position and the drift) */
    #ugb_party_title {
        display: block;
    }

    /* a 240px bar cannot hold the readout and two buttons with their words on
       them: the glyphs are enough, and the wording lives in the title */
    #ugb_party_bar {
        gap: 7px;
    }

    #ugb_party_sound_txt {
        display: none;
    }

    /* a thicker bar is a much easier thing to grab with a thumb */
    #ugb_party_bar {
        height: 34px;
        font-size: 10px;
    }

    #ugb_party_state {
        display: none;
    }

    #ugb_party_player {
        top: 35px;
    }

    /* a thumb needs a bigger target than the pill gets on a desktop */
    #ugb_party_prompt {
        left: 6px;
        bottom: 6px;
        padding: 5px 10px;
        font-size: 10px;
        line-height: 16px;
    }

    /* eleven readouts in a 117px player: smaller type, not fewer numbers */
    #ugb_party_stats {
        padding: 3px 5px;
        font-size: 8px;
        line-height: 10px;
    }

    #ugb_party_stats i {
        width: 52px;
    }

    #ugb_party_stats span {
        margin-left: 52px;
    }
}
