:root {
            --chat-width: 350px;
            --twitch-purple: #9147ff;
            --tab-height: 35px;
        }

        body, html {
            margin: 0; padding: 0; height: 100%;
            background: url(pics/orange.jpg);
            background-repeat: repeat;
            color: white;
            font-family: sans-serif; overflow: hidden;
        }

        #setup-screen {
            display: flex; flex-direction: column; align-items: center; 
                /*justify-content: center; */
            height: 100vh; text-align: center; background: radial-gradient(circle, #1f1f23 0%, #0e0e10 100%);
        }
  
        .setup-card { 
            background: #18181b; 
            padding: 35px 40px; 
            border-radius: 12px; 
            width: 480px; 
            max-width: 90vw;
            box-shadow: 0 15px 40px rgba(0,0,0,0.6);
            border: 1px solid #2a2a2f;
        }

        .setup-radio-group {
            display: flex;
            gap: 8px;
            margin-bottom: 20px;
        }

        .setup-radio-group label {
            flex: 1;
            text-align: center;
            background: #0e0e10;
            border: 1px solid #333;
            padding: 10px 0;
            border-radius: 6px;
            font-size: 12px;
            font-weight: bold;
            cursor: pointer;
            color: #adadb8;
            transition: all 0.2s ease;
        }

        .setup-radio-group label:hover {
            background: #252529;
        }

        .setup-radio-group label:has(input:checked) {
            background: #35353b;
            color: white;
            border-color: var(--twitch-purple);
            box-shadow: 0 0 10px rgba(145, 71, 255, 0.2);
        }

        .setup-radio-group input[type="radio"] {
            display: none; 
        }

        input[type="text"] {
            width: 100%; padding: 12px; margin: 15px 0; border-radius: 4px;
            border: 1px solid #333; background: #000; color: white; box-sizing: border-box;
        }

        #dashboard { display: none; height: 100vh; }
        #main-container { display: flex; width: 100vw; height: 100vh; }

        #chat-sidebar {
            width: var(--chat-width); display: flex; flex-direction: column;
            background: #18181b; border-right: 1px solid #333; flex-shrink: 0;
            z-index: 10 !important;
            position: relative;
            overflow: hidden;
        }

        #chat-sidebar:not(.no-transition) {
            transition: width 0.25s ease, min-width 0.25s ease, opacity 0.2s ease;
        }

        #chat-sidebar.chat-hidden {
            width: 0 !important;
            min-width: 0 !important;
            opacity: 0;
            pointer-events: none;
            border: none;
        }

        /* dragable line */
        #chat-resize-handle {
            position: absolute;
            top: 0;
            width: 10px;
            height: 100%;
            cursor: col-resize;
            z-index: 25;
            background: transparent;
        }

        #chat-sidebar:first-child #chat-resize-handle { right: -5px; }
        #chat-sidebar:last-child #chat-resize-handle { left: -5px; }

        #chat-resize-handle:hover,
        #chat-resize-handle.resizing {
            background: var(--twitch-purple);
        }

        #chat-sidebar.chat-hidden #chat-resize-handle {
            display: none;
        }


        #drag-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0;
            width: 100vw; height: 100vh;
            z-index: 9999;
            cursor: col-resize;
        }

        #drag-overlay.active {
            display: block;
        }

        @media (orientation: portrait) {
            #chat-resize-handle { display: none; }
        }

        #sidebar-controls {
            display: grid; 
            grid-template-columns: auto 25px repeat(4, 1fr) 25px;
            gap: 4px; padding: 8px;
            background: #1f1f23;
            border-bottom: 1px solid #333;
        }
        /* HERE LIES THE THEME SLIDER*/
        #theme-presence{
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 8px;
            background: #18181b;
            border-bottom: 1px solid #333;
        }

        #theme-picker-btn {
            width: 20px;
            height: 20px;
            border: none;
            border-radius: 0;
            background: transparent;
            color: #dfe4ff;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            padding: 0;
            flex-shrink: 0;
        }

        #theme-picker-btn svg {
            width: 20px;
            height: 20px;
            display: block;
        }

        #theme-picker-btn:hover {
            background: transparent;
            border-color: transparent;
            opacity: 0.9;
        }

        .theme-slider-group {
            flex: 1 1 0;
            min-width: 0;
        }

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: #444; 
  outline: none;
  display: block;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e63946; 
  cursor: pointer;
  border: none;
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e63946;
  cursor: pointer;
  border: none;
}


.slider::-moz-range-track {
  background: #444;
  height: 6px;
  border-radius: 5px;
}

/*OTHER SHIT BELOW*/
        #sidebar-controls button {
            width: 100%; font-size: 10px; padding: 6px 0; border-radius: 4px;
            border: none; cursor: pointer; font-weight: bold;
            background: var(--twitch-purple); color: white;
        }

#bring-back-chat{
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: bold;
    background: #3887b5;
    z-index: 15;
    width: 12px;
    height: 64px;
    border: none;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.45);
    transition: background 0.2s, width 0.15s;
}

#bring-back-chat:hover {
    background: #4a9fd1;
    width: 30px;
}

#bring-back-chat.visible {
    display: flex;
}

#bring-back-chat.side-left {
    left: 0;
    border-radius: 0 6px 6px 0;
}

#bring-back-chat.side-right {
    right: 0;
    border-radius: 6px 0 0 6px;
}

#bring-back-chat.visible::after {
    content: '';
    position: absolute;
    top: 0;
    width: 24px;
    height: 100%;
}

#bring-back-chat.visible.side-left::after { left: 100%; }
#bring-back-chat.visible.side-right::after { right: 100%; }

#stream-icon-strip {
    position: fixed;
    top: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 14;
    pointer-events: none;
    visibility: hidden;
    transition: transform 0.2s ease;
    justify-content: center;
}
#stream-icon-strip.side-left { left:30px; transform: translateX(calc(-100% - 80px)); }
#stream-icon-strip.side-right { right: 30px; transform: translateX(calc(100% + 80px)); }
#stream-icon-strip.visible { pointer-events: auto; visibility: visible; }
#bring-back-chat.visible:hover ~ #stream-icon-strip.visible,
#stream-icon-strip.visible:hover { transform: translateX(0); }

.stream-icon-entry { position: relative; display: flex; align-items: center; height: 40px; pointer-events: auto; }
.stream-icon { width: 34px; height: 34px; border: 2px solid #6b6d78; border-radius: 50%; padding: 0; overflow: hidden; background: #25262c; color: #fff; font-size: 11px; font-weight: bold; cursor: pointer; flex: 0 0 auto; }
.stream-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stream-icon-entry.is-offline .stream-icon { filter: grayscale(1); opacity: 0.55; border-color: #555860; }
.stream-icon-entry.is-offline .stream-icon img { opacity: 0.7; }
.stream-icon-entry.is-live .stream-icon { filter: none; opacity: 1; border-color: #6b6d78; }
.stream-icon-entry.focused .stream-icon { border-color: #3cd8ff; box-shadow: 0 0 0 2px rgba(60, 216, 255, 0.25); }
.stream-icon-controls { display: flex; gap: 4px; opacity: 0; pointer-events: none; padding: 4px; background: #18181b; border: 1px solid #3a3b44; border-radius: 5px; transition: opacity 0.15s ease, transform 0.15s ease; }
.stream-icon-entry:hover .stream-icon-controls, .stream-icon-entry:focus-within .stream-icon-controls { opacity: 1; pointer-events: auto; transform: translateX(0); }
.stream-icon-controls button { width: 24px; height: 24px; border: 0; border-radius: 3px; background: #35353b; color: #fff; cursor: pointer; font-size: 12px; font-weight: bold; }
.stream-icon-controls button:hover { background: var(--twitch-purple); }
.stream-icon-controls .remove-stream:hover { background: #eb0400; }
#stream-icon-strip.side-left .stream-icon-controls { order: 2; transform: translateX(-6px); }
#stream-icon-strip.side-right .stream-icon-controls { order: 0; transform: translateX(6px); }
#stream-icon-strip.side-right .stream-icon { order: 2; }

@media (orientation: portrait) {
    #bring-back-chat { display: none !important; }
}

        #home-link button { padding: 6px 10px; min-width: 30px; }
        #sidebar-controls button.secondary { background: #35353b; }
        #sidebar-controls button.reset-btn { background: #eb0400; }

        #tabs-header {
            display: flex; flex-wrap: wrap; background: #0e0e10;
            min-height: var(--tab-height); border-bottom: 1px solid #333;
            padding: 2px; gap: 2px;
        }

        .tab {
            display: flex; align-items: center; gap: 5px; padding: 6px 8px;
            cursor: pointer; background: #1f1f23; border: 1px solid #000;
            font-size: 11px; white-space: nowrap; flex: 1 1 auto;
            justify-content: space-between; max-width: 48%;
        }

        .tab.active { 
                background: #26262c; 
                border-bottom: 2px solid #3cd8ff; 
                box-shadow: inset 0 -15px 20px -10px rgb(134 195 195 / 63%);
        }

        .tab.focused { 
                background: rgb(0, 47, 74); 
                color: white; 
        }

        .focus-btn {
            background: transparent; border: none; color: #adadb8;
            cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1;
        }
        .focus-btn:hover { color: white; }

        #chat-frames { flex-grow: 1; position: relative; }
        .chat-frame { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; border: none; }
        .chat-frame.active { display: block; }

        #video-grid { flex-grow: 1; 
                     position: relative; 
                     background: rgba(0,0,0,0.5); 
                     overflow: hidden; 
                     display: block;
                    }
        .video-container { 
                position: absolute; 
                transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); 
                aspect-ratio: 16/9; 

                /* borders */
                /*padding: 4.5px 8px; no more padding because Lavastar asked me to*/ 
                  box-sizing: border-box;
                z-index: 200;

        }
.video-container iframe {
               /* border: 3px solid;
  border-image-source: linear-gradient(45deg, #00f2ff, #7000ff);
  border-image-slice: 1;
  background: #000;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.4),  inset 0 0 10px rgba(112, 0, 255, 0.4); */
        
}

        
        /* force hide */
        .is-hidden { display: none !important; }

/*testing new way of hiding thins*/
.is-hidden-moved {
    position: absolute !important;
    left: -9999px !important; 
    top: 0 !important;
    width: 400px !important;
    height: 225px !important;
    pointer-events: none;
}

        .close-btn { font-size: 14px; font-weight: bold; color: #adadb8; padding: 0 4px; }
        .close-btn:hover { color: #ff4a4a; }

        #copy-popup {
            display: none; position: fixed; bottom: 20px; left: 50%; 
            transform: translateX(-50%); background: #1f1f23; 
            border: 2px solid var(--twitch-purple); padding: 20px; 
            border-radius: 8px; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,0.5); width: 300px;
        }

.tab.is-live {
    border-left: 3px solid #ff5454 !important;
        box-shadow: inset 15px 0 10px -10px rgb(255 62 62);
}

.tab.custom-iframe.is-live {
    border-left: 3px solid #ffffff !important;
    box-shadow: inset 15px 0 10px -10px rgba(255, 255, 255, 0.8);
}

.tab.is-offline {
    color: #adadb8;
    opacity: 0.7;
}

#tabs-header .tab.is-hidden { /*forcing offline tabs to stay visible*/
    /* display: flex !important; */
}

/* vertical mode */
@media (orientation: portrait) {
    #main-container {
        flex-direction: column;
    }

    #chat-sidebar {
        width: 100% !important; 
        height: 68vh;           
        border-right: none;
        border-top: 1px solid #333;
        
    }

    #video-grid {
        width: 100% !important;
        height: 1vh;           
    }

    #main-container {
        display: flex;
    }
}

.video-container.youtube iframe {
    /* border: 3px solid;
    border-image-source: linear-gradient(45deg, #f57fb0, #750000);
    border-image-slice: 1;
    background: #000;
    box-shadow: 0 0 15px rgb(255 106 106 / 40%),  inset 0 0 10px rgba(112, 0, 255, 0.4); */
}


#save-layout-prompt {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    background: #18181b;
    border: 1px solid var(--twitch-purple);
    padding: 15px;
    border-radius: 8px;
    z-index: 10001;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

#save-layout-prompt button {
    background: var(--twitch-purple);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
    font-size: 12px;
}



/* drop form */
#tabs-header.drag-over {
    background: rgba(145, 71, 255, 0.2) !important;
    outline: 2px dashed var(--twitch-purple);
    outline-offset: -4px;
}

/* temp fix attempt */
body.dragging-active iframe {
    pointer-events: none !important;
}


/*youtube playlist queue*/

.playlist-sidebar {
    display: none;
    flex-direction: column;
    height: 100%;
    background: #0e0e10;
    overflow-y: auto;
    border-left: 1px solid #2a2a2f;
}

.theme-picker {
    display: none;
    flex-direction: column;
    height: 100%;
    background: #0e0e10;
    overflow-y: auto;
    border-left: 1px solid #2a2a2f;
    padding: 10px;
    box-sizing: border-box;
}

.theme-picker.active {
    display: flex;
}

.theme-picker-header {
    font-size: 12px;
    font-weight: bold;
    color: #adadb8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 4px 10px;
    border-bottom: 1px solid #2a2a2f;
    margin-bottom: 10px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.theme-option {
    position: relative;
    border: 1px solid #2a2a2f;
    border-radius: 8px;
    overflow: hidden;
    background: #18181b;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    aspect-ratio: 1;
}

.theme-option:hover {
    transform: translateY(-1px);
    border-color: #5b5d6b;
}

.theme-option.selected {
    border-color: var(--twitch-purple);
    box-shadow: 0 0 0 1px rgba(145, 71, 255, 0.45);
}

.theme-option img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.theme-number {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 999px;
    line-height: 1.2;
}

.playlist-sidebar.active {
    display: flex;
}

.playlist-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #1f1f23;
    transition: background 0.2s;
}

.playlist-item:hover {
    background: #1f1f23;
}

.playlist-item.playing {
    background: #8c0036;
    border-left: 3px solid #f70260;
}

.playlist-item img {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.playlist-item-info {
    flex: 1;
    font-size: 12px;
    color: #efeff1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.playlist-sidebar::-webkit-scrollbar {
    display: none;
}

.playlist-sidebar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    overflow-y: auto; 
}

.playlist-item-index {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px; 
    font-size: 12px;
    color: #adadb8; 
    font-weight: bold;
    flex-shrink: 0; 
}


.close-sidebar-btn {
    background-color: #35353b;
    color: #adadb8;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.close-sidebar-btn:hover {
    background-color: #e91e63; /* Optional: Makes it red on hover */
    color: white;
}