html {
    overflow-x: hidden;
    height: 100%;
}
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a2a3a 0%, #233447 100%);
    padding: 0;
    margin: 0;
    width: 100vw;
    box-sizing: border-box;
}
.main-flex-layout {
    display: flex;
    flex-direction: row;
    max-width: 1400px;
    width: 100%;
    margin: 48px auto 0 auto;
    background: rgba(20, 24, 34, 0.92);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    overflow: hidden;
    z-index: 2;
    min-height: 600px;
}
.sidebar-channel-list {
    width: 36%;
    min-width: 260px;
    max-width: 420px;
    background: rgba(24, 28, 44, 0.98);
    border-right: 1.5px solid rgba(60, 255, 180, 0.08);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: 100%;
}
.main-player-area {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: rgba(20, 24, 34, 0.92);
    padding: 32px 0 0 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
    overflow-y: auto; /* Allow vertical scrolling if needed */
}
.footer {
    width: 100vw;
    background: rgba(20, 24, 34, 0.95);
    color: #b6eada;
    text-align: center;
    font-size: 1em;
    padding: 16px 0 8px 0;
    margin-top: auto;
    border-top: 1.5px solid rgba(60, 255, 180, 0.08);
    position: relative;
    left: 0;
    transform: none;
    z-index: 10;
}
.footer {
    width: 100vw;
    text-align: center;
    margin: 32px 0 0 0;
    padding: 16px 0 0 0;
    background: transparent;
    box-shadow: none;
    position: static;
    left: 0;
    bottom: 0;
}
html, body {
    overflow-x: hidden;
    overflow-y: auto;
    max-width: 100vw;
    min-height: 100%;
    background: transparent;
    padding: 0;
    margin: 0;
}
*, *::before, *::after {
    box-sizing: border-box !important;
}
/* Node-Cast TV style sidebar layout */
 .main-flex-layout {
    display: flex;
    flex-direction: row;
    height: 800px;
    width: 1400px;
    max-width: 98vw;
    max-height: 98vh;
    margin: 24px auto;
    gap: 0;
    overflow-y: hidden !important;
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    background: rgba(16, 21, 28, 0.95);
}
 .sidebar-channel-list {
    width: 420px;
    max-width: 420px;
    background: rgba(18, 24, 28, 0.98);
    border-right: 2px solid #111a1a;
    box-shadow: 2px 0 24px #00e67611;
    padding: 0 0 0 0;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: 100vh !important;
    position: relative;
    top: 0;
    z-index: 10;
}
 .main-player-area {
    width: calc(100% - 420px);
    max-width: calc(100% - 420px);
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 32px 0 0 0;
    height: 100vh !important;
    overflow-x: hidden; /* Prevent horizontal overflow */
    overflow-y: auto; /* Allow vertical scrolling if needed */
}
.player-section {
    margin: 0 auto 32px auto;
    width: 100%;
    max-width: 1240px;
    overflow: hidden;
    padding: 32px 24px;
    box-sizing: border-box;
    background: rgba(18, 24, 28, 0.92);
    border-radius: 22px;
    box-shadow: 0 8px 32px 0 rgba(0, 230, 118, 0.10), 0 1.5px 8px 0 #00e67622;
    border: 1.5px solid rgba(0, 230, 118, 0.18);
    backdrop-filter: blur(8px);
    padding: 32px 24px 24px 24px;
}
.embed-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    margin: 0 auto;
    background: #000;
    border-radius: 16px;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 9) {
    .embed-container {
        padding-bottom: 56.25%;
        height: 0;
    }
}

#mainVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block !important;
    visibility: visible !important;
    border-radius: 0;
    margin: 0;
    padding: 0;
}
                @media (max-width: 1300px) {
                    .main-flex-layout {
                        flex-direction: column;
                    }
                    .sidebar-channel-list {
                        width: 100vw;
                        max-width: 100vw;
                        min-width: 0;
                        border-right: none;
                        border-bottom: 2px solid #111a1a;
                        height: auto;
                        position: static;
                        box-shadow: none;
                        order: 2;
                    }
                    .main-player-area {
                        width: 100vw;
                        max-width: 100vw;
                        min-width: 0;
                        padding: 0;
                        order: 1;
                        overflow-x: hidden;
                        overflow-y: auto;
                        height: 100vh;
                    }
                }
                /* Node-Cast TV inspired theme */
                body {
                    background: linear-gradient(135deg, #0a0f14 0%, #1a232d 100%);
                    color: #eafcfb;
                    font-family: 'Inter', Arial, sans-serif;
                    min-height: 100vh;
                }
                .background {
                    background: radial-gradient(circle at 30% 20%, #00e67633 0%, #0a0f14 80%, #1a232d 100%);
                    opacity: 0.18;
                }
                .player-section {
                    width: 100%;
                    max-width: 1240px;
                    overflow: hidden;
                    padding: 32px 24px;
                    box-sizing: border-box;
                    margin: 32px auto;
                    background: rgba(18, 24, 28, 0.92);
                    border-radius: 22px;
                    box-shadow: 0 8px 32px 0 rgba(0, 230, 118, 0.10), 0 1.5px 8px 0 #00e67622;
                    border: 1.5px solid rgba(0, 230, 118, 0.18);
                    backdrop-filter: blur(8px);
                }
                .embed-container {
                    position: relative;
                    width: 100%;
                    max-width: 1200px;
                    aspect-ratio: 16 / 9;
                    overflow: hidden;
                    margin: 0 auto;
                    background: #000;
                    border-radius: 16px;
                }
                
                /* Fallback for browsers without aspect-ratio support */
                @supports not (aspect-ratio: 16 / 9) {
                    .embed-container {
                        padding-bottom: 56.25%;
                        height: 0;
                    }
                }
                
                #mainVideo {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    object-fit: contain;
                    background: #000;
                    display: block !important;
                    visibility: visible !important;
                    border-radius: 0;
                    margin: 0;
                    padding: 0;
                }
                .player-info {
                    color: #eafcfb;
                    font-size: 1.1em;
                    margin-top: 18px;
                    text-align: center;
                }
                .channel-list {
                    background: rgba(18, 24, 28, 0.92);
                    border-radius: 22px;
                    box-shadow: 0 4px 24px 0 #00e67611;
                    border: 1.5px solid rgba(0, 230, 118, 0.13);
                    backdrop-filter: blur(8px);
                    max-width: 1240px;
                    margin: 0 auto 32px auto;
                    padding: 16px 24px 16px 24px;
                }
                .channel-list-title {
                    color: #00e676;
                    font-weight: 700;
                    letter-spacing: 1px;
                    font-size: 1.3em;
                }
                .channel-count {
                    color: #7fffd4;
                    font-size: 1em;
                }
                .channel-grid .row {
                    margin-left: 0;
                    margin-right: 0;
                }
                .channel-item {
                    background: rgba(0, 230, 118, 0.08);
                    border-radius: 14px;
                    box-shadow: 0 2px 12px #00e67611;
                    padding: 12px 8px 10px 8px;
                    cursor: pointer;
                    transition: background 0.2s, box-shadow 0.2s, border 0.2s;
                    border: 2px solid transparent;
                    width: 100%;
                    min-width: 0;
                    box-sizing: border-box;
                    overflow: hidden;
                    margin-left: auto;
                    margin-right: auto;
                }
                .channel-item.active, .channel-item:hover {
                    background: #00e676;
                    color: #0a0f14;
                    border-color: #00e676;
                    box-shadow: 0 4px 24px #00e67633;
                }
                .channel-thumbnail {
                    width: 100%;
                    max-width: 140px;
                    height: 80px;
                    object-fit: cover;
                    border-radius: 8px;
                    margin-bottom: 8px;
                    background: #181c20;
                    box-shadow: 0 2px 8px #00e67611;
                }
                .channel-name {
                    font-size: 1.08em;
                    font-weight: 600;
                    text-align: center;
                    color: #eafcfb;
                    margin-bottom: 2px;
                }
                .nav-tabs .nav-link {
                    color: #eafcfb;
                    background: rgba(0, 230, 118, 0.08);
                    border: none;
                    border-radius: 10px 10px 0 0;
                    margin-right: 4px;
                    font-weight: 500;
                    transition: background 0.2s, color 0.2s;
                }
                .nav-tabs .nav-link.active {
                    background: #00e676;
                    color: #0a0f14;
                }
                .tab-content {
                    background: transparent;
                    border-radius: 0 0 16px 16px;
                }
                .footer {
                    background: #181c20;
                    color: #7fffd4;
                    border-radius: 0 0 22px 22px;
                    padding: 18px 0 8px 0;
                    text-align: center;
                    margin-top: 32px;
                    box-shadow: 0 -2px 16px #00e67611;
                }
                .footer a {
                    color: #00e676;
                    text-decoration: underline;
                }
                /* theme-toggle removed */
                @media (max-width: 1300px) {
                    .channel-thumbnail {
                        max-width: 100px;
                        height: 60px;
                    }
                }
                @media (max-width: 900px) {
                    .channel-thumbnail {
                        max-width: 80px;
                        height: 48px;
                    }
                    .channel-item {
                        min-width: 100px;
                        max-width: 120px;
                    }
                }
                /* Juzt-TV inspired theme */
                body {
                    background: linear-gradient(135deg, #10131a 0%, #232b3b 100%);
                    color: #eaf6ff;
                    font-family: 'Inter', Arial, sans-serif;
                    min-height: 100vh;
                }
                .background {
                    background: radial-gradient(circle at 30% 20%, #1e90ff33 0%, #10131a 80%, #232b3b 100%);
                    opacity: 0.22;
                }
                .player-section {
                    width: 100%;
                    max-width: 1240px;
                    overflow: hidden;
                    padding: 32px 24px;
                    box-sizing: border-box;
                    margin: 32px auto;
                    background: rgba(24, 28, 38, 0.85);
                    border-radius: 24px;
                    box-shadow: 0 8px 32px 0 rgba(30, 144, 255, 0.10), 0 1.5px 8px 0 #1e90ff22;
                    border: 1.5px solid rgba(30, 144, 255, 0.18);
                    backdrop-filter: blur(8px);
                }
                .embed-container {
                    position: relative;
                    width: 100%;
                    max-width: 1200px;
                    aspect-ratio: 16 / 9;
                    overflow: hidden;
                    margin: 0 auto;
                    background: #000;
                    border-radius: 16px;
                }
                
                /* Fallback for browsers without aspect-ratio support */
                @supports not (aspect-ratio: 16 / 9) {
                    .embed-container {
                        padding-bottom: 56.25%;
                        height: 0;
                    }
                }
                
                #mainVideo {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    object-fit: contain;
                    background: #000;
                    display: block !important;
                    visibility: visible !important;
                    border-radius: 0;
                    margin: 0;
                    padding: 0;
                }
                .player-info {
                    color: #eaf6ff;
                    font-size: 1.1em;
                    margin-top: 18px;
                    text-align: center;
                }
                .channel-list {
                    background: rgba(24, 28, 38, 0.85);
                    border-radius: 24px;
                    box-shadow: 0 4px 24px 0 #1e90ff11;
                    border: 1.5px solid rgba(30, 144, 255, 0.13);
                    backdrop-filter: blur(8px);
                    max-width: 1240px;
                    margin: 0 auto 32px auto;
                    padding: 16px 24px 16px 24px;
                }
                .channel-list-title {
                    color: #1e90ff;
                    font-weight: 700;
                    letter-spacing: 1px;
                    font-size: 1.3em;
                }
                .channel-count {
                    color: #7ecbff;
                    font-size: 1em;
                }
                .channel-grid .row {
                    margin-left: 0;
                    margin-right: 0;
                }
                .channel-item {
                    background: rgba(30, 144, 255, 0.08);
                    border-radius: 16px;
                    box-shadow: 0 2px 12px #1e90ff11;
                    padding: 12px 8px 10px 8px;
                    cursor: pointer;
                    transition: background 0.2s, box-shadow 0.2s, border 0.2s;
                    border: 2px solid transparent;
                    width: 100%;
                    min-width: 0;
                    box-sizing: border-box;
                    overflow: hidden;
                    margin-left: auto;
                    margin-right: auto;
                }
                .channel-item.active, .channel-item:hover {
                    background: #1e90ff;
                    color: #10131a;
                    border-color: #1e90ff;
                    box-shadow: 0 4px 24px #1e90ff33;
                }
                .channel-thumbnail {
                    width: 100%;
                    max-width: 140px;
                    height: 80px;
                    object-fit: cover;
                    border-radius: 10px;
                    margin-bottom: 8px;
                    background: #181c26;
                    box-shadow: 0 2px 8px #1e90ff11;
                }
                .channel-name {
                    font-size: 1.08em;
                    font-weight: 600;
                    text-align: center;
                    color: #eaf6ff;
                    margin-bottom: 2px;
                }
                .nav-tabs .nav-link {
                    color: #eaf6ff;
                    background: rgba(30, 144, 255, 0.08);
                    border: none;
                    border-radius: 10px 10px 0 0;
                    margin-right: 4px;
                    font-weight: 500;
                    transition: background 0.2s, color 0.2s;
                }
                .nav-tabs .nav-link.active {
                    background: #1e90ff;
                    color: #10131a;
                }
                .tab-content {
                    background: transparent;
                    border-radius: 0 0 16px 16px;
                }
                .footer {
                    background: #181c26;
                    color: #7ecbff;
                    border-radius: 0 0 24px 24px;
                    padding: 18px 0 8px 0;
                    text-align: center;
                    margin-top: 32px;
                    box-shadow: 0 -2px 16px #1e90ff11;
                }
                .footer a {
                    color: #1e90ff;
                    text-decoration: underline;
                }
                /* theme-toggle removed */
                @media (max-width: 1300px) {
                    .player-section, .channel-list {
                        max-width: 100vw;
                        padding-left: 4vw;
                        padding-right: 4vw;
                    }
                    .channel-thumbnail {
                        max-width: 100px;
                        height: 60px;
                    }
                }
                @media (max-width: 900px) {
                    .channel-thumbnail {
                        max-width: 80px;
                        height: 48px;
                    }
                    .channel-item {
                        min-width: 100px;
                        max-width: 120px;
                    }
                }
                /* Responsive adjustments for player and channel grid */
                .player-section {
                    width: 100%;
                    max-width: 1240px;
                    overflow: hidden;
                    padding: 32px 24px;
                    box-sizing: border-box;
                    margin: 0 auto;
                }
                .embed-container {
                    position: relative;
                    width: 100%;
                    max-width: 1200px;
                    aspect-ratio: 16 / 9;
                    overflow: hidden;
                    margin: 0 auto;
                    background: #000;
                    border-radius: 16px;
                }
                
                /* Fallback for browsers without aspect-ratio support */
                @supports not (aspect-ratio: 16 / 9) {
                    .embed-container {
                        padding-bottom: 56.25%;
                        height: 0;
                    }
                }
                
                #mainVideo {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    object-fit: contain;
                    background: #000;
                    display: block !important;
                    visibility: visible !important;
                    border-radius: 0;
                    margin: 0;
                    padding: 0;
                }
                .channel-list {
                    max-width: 1240px;
                    margin-left: auto;
                    margin-right: auto;
                    padding: 0 16px 16px 16px;
                }
                .channel-grid .row {
                    margin-left: 0;
                    margin-right: 0;
                }
                .channel-item {
                    width: 100%;
                    min-width: 0;
                    box-sizing: border-box;
                    overflow: hidden;
                    margin-left: auto;
                    margin-right: auto;
                }
                .channel-thumbnail {
                    max-width: 140px;
                    height: 80px;
                }
                @media (max-width: 1300px) {
                    .player-section, .channel-list {
                        max-width: 100vw;
                        padding-left: 4vw;
                        padding-right: 4vw;
                    }
                    .channel-thumbnail {
                        max-width: 100px;
                        height: 60px;
                    }
                }
                @media (max-width: 900px) {
                    .channel-thumbnail {
                        max-width: 80px;
                        height: 48px;
                    }
                    .channel-item {
                        min-width: 100px;
                        max-width: 120px;
                    }
                }
                /* Modern Dark Theme for Web TV Player */
                body {
                    background: linear-gradient(135deg, #232526 0%, #414345 100%);
                    color: #eaeaea;
                    font-family: 'Inter', Arial, sans-serif;
                    min-height: 100vh;
                }

                .main-container, .player-section, .channel-list {
                    background: rgba(30, 32, 34, 0.98);
                    border-radius: 16px;
                    box-shadow: 0 4px 32px rgba(0,0,0,0.18);
                }

                .player-section {
                    border: 1px solid #333;
                }

                .channel-list {
                    border: 1px solid #222;
                    padding: 16px 0 0 0;
                }

                .channel-list-title {
                    color: #00e6e6;
                    font-weight: 600;
                    letter-spacing: 1px;
                }

                .channel-count {
                    color: #aaa;
                    font-size: 1em;
                }

                .channel-item {
                    background: #23272b;
                    border-radius: 12px;
                    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
                    padding: 10px 8px 8px 8px;
                    cursor: pointer;
                    transition: background 0.2s, box-shadow 0.2s;
                    border: 2px solid transparent;
                    width: 100%;
                    min-width: 0;
                    box-sizing: border-box;
                    overflow: hidden;
                }
                .channel-item.active, .channel-item:hover {
                    background: #00e6e6;
                    color: #23272b;
                    border-color: #00e6e6;
                    box-shadow: 0 4px 16px rgba(0,230,230,0.12);
                }
                .channel-thumbnail {
                    width: 100%;
                    max-width: 120px;
                    height: 72px;
                    object-fit: cover;
                    border-radius: 8px;
                    margin-bottom: 6px;
                    background: #181818;
                    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
                }
                .channel-name {
                    font-size: 1em;
                    font-weight: 500;
                    text-align: center;
                    color: #eaeaea;
                    margin-bottom: 2px;
                }
                .nav-tabs .nav-link {
                    color: #eaeaea;
                    background: #23272b;
                    border: none;
                    border-radius: 8px 8px 0 0;
                    margin-right: 4px;
                    font-weight: 500;
                    transition: background 0.2s, color 0.2s;
                }
                .nav-tabs .nav-link.active {
                    background: #00e6e6;
                    color: #23272b;
                }
                .tab-content {
                    background: transparent;
                    border-radius: 0 0 16px 16px;
                }
                .player-info {
                    color: #eaeaea;
                    font-size: 1.1em;
                    margin-top: 10px;
                    text-align: center;
                }
                .footer {
                    background: #181818;
                    color: #aaa;
                    border-radius: 0 0 16px 16px;
                    padding: 18px 0 8px 0;
                    text-align: center;
                    margin-top: 32px;
                    box-shadow: 0 -2px 16px rgba(0,0,0,0.10);
                }
                .footer a {
                    color: #00e6e6;
                    text-decoration: underline;
                }
                /* theme-toggle removed */
                .background {
                    position: fixed;
                    top: 0;
                    left: 0;
                    width: 100vw;
                    height: 100vh;
                    background: radial-gradient(circle at 20% 20%, #00e6e6 0%, #232526 60%, #181818 100%);
                    opacity: 0.18;
                    z-index: -1;
                }
                /* --- CLEAN CHANNEL GRID FIX --- */
                .channel-grid {
                    display: grid !important;
                    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
                    gap: 12px !important;
                    padding: 8px !important;
                    margin-top: 10px !important;
                }
                .channel-item {
                    background: rgba(30,30,30,0.95) !important;
                    border-radius: 10px !important;
                    text-align: center !important;
                    cursor: pointer !important;
                    border: 2px solid transparent !important;
                    font-size: 0.95em !important;
                    position: relative !important;
                    overflow: hidden !important;
                    padding: 8px 4px 10px 4px !important;
                    transition: box-shadow 0.2s, border 0.2s !important;
                    width: 100% !important;
                    min-width: 0 !important;
                    box-sizing: border-box !important;
                    margin: 0 auto !important;
                }
                .channel-item.active {
                    border-color: #a084ff !important;
                    box-shadow: 0 0 0 2px #a084ff33 !important;
                }
                .channel-thumbnail {
                    width: 80px !important;
                    height: 48px !important;
                    object-fit: contain !important;
                    border-radius: 6px !important;
                    background: #222 !important;
                    margin-bottom: 4px !important;
                    margin-top: 2px !important;
                    display: block !important;
                    margin-left: auto !important;
                    margin-right: auto !important;
                }
                .channel-name {
                    font-size: 0.92em !important;
                    font-weight: 500 !important;
                    color: #fff !important;
                    margin-bottom: 2px !important;
                    min-height: 2.2em !important;
                    line-height: 1.2 !important;
                    white-space: normal !important;
                    word-break: break-word !important;
                    padding: 4px 2px 2px 2px !important;
                    text-align: center !important;
                    overflow: hidden !important;
                    text-overflow: ellipsis !important;
                }
                @media (max-width: 900px) {
                    .channel-grid { grid-template-columns: repeat(2, 1fr) !important; }
                }
                @media (max-width: 600px) {
                    .channel-grid { grid-template-columns: repeat(1, 1fr) !important; }
                }
                /* --- END CLEAN CHANNEL GRID FIX --- */
                /* --- GUARANTEED MULTI-COLUMN CHANNEL GRID BELOW PLAYER --- */
                .channel-grid {
                    display: grid !important;
                    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
                    gap: 12px !important;
                    padding: 8px !important;
                    margin-top: 10px !important;
                }
                .channel-item {
                    width: 100% !important;
                    min-width: 0 !important;
                    box-sizing: border-box !important;
                    overflow: hidden !important;
                    margin: 0 auto !important;
                    padding: 6px 4px 8px 4px !important;
                    background: rgba(30,30,30,0.95) !important;
                    border-radius: 10px !important;
                    text-align: center !important;
                    cursor: pointer !important;
                    transition: box-shadow 0.2s, border 0.2s !important;
                    border: 2px solid transparent !important;
                    font-size: 0.95em !important;
                    position: relative !important;
                    overflow: hidden !important;
                }
                .channel-thumbnail {
                    width: 80px !important;
                    height: 48px !important;
                    object-fit: contain !important;
                    border-radius: 6px !important;
                    background: #222 !important;
                    margin-bottom: 4px !important;
                    margin-top: 2px !important;
                    display: block !important;
                    margin-left: auto !important;
                    margin-right: auto !important;
                }
                .channel-name {
                    font-size: 0.92em !important;
                    font-weight: 500 !important;
                    color: #fff !important;
                    margin-bottom: 2px !important;
                    min-height: 2.2em !important;
                    line-height: 1.2 !important;
                    white-space: normal !important;
                    word-break: break-word !important;
                    padding: 4px 2px 2px 2px !important;
                    text-align: center !important;
                    overflow: hidden !important;
                    text-overflow: ellipsis !important;
                }
                @media (max-width: 900px) {
                    .channel-grid { grid-template-columns: repeat(2, 1fr) !important; }
                }
                @media (max-width: 600px) {
                    .channel-grid { grid-template-columns: repeat(1, 1fr) !important; }
                }
                /* --- END GUARANTEED MULTI-COLUMN CHANNEL GRID --- */
                /* --- FORCE FLEX MULTI-COLUMN CHANNEL GRID --- */
                .channel-grid {
                    display: flex !important;
                    flex-wrap: wrap !important;
                    gap: 12px !important;
                    padding: 8px !important;
                    margin-top: 10px !important;
                    justify-content: flex-start !important;
                }
                .channel-item {
                    width: 100% !important;
                    min-width: 0 !important;
                    flex: 0 1 140px !important;
                    box-sizing: border-box !important;
                    overflow: hidden !important;
                    margin: 0 !important;
                    padding: 6px 4px 8px 4px !important;
                    background: rgba(30,30,30,0.95) !important;
                    border-radius: 10px !important;
                    text-align: center !important;
                    cursor: pointer !important;
                    transition: box-shadow 0.2s, border 0.2s !important;
                    border: 2px solid transparent !important;
                    font-size: 0.95em !important;
                    position: relative !important;
                    overflow: hidden !important;
                }
                .channel-thumbnail {
                    width: 80px !important;
                    height: 48px !important;
                    object-fit: contain !important;
                    border-radius: 6px !important;
                    background: #222 !important;
                    margin-bottom: 4px !important;
                    margin-top: 2px !important;
                    display: block !important;
                    margin-left: auto !important;
                    margin-right: auto !important;
                }
                .channel-name {
                    font-size: 0.92em !important;
                    font-weight: 500 !important;
                    color: #fff !important;
                    margin-bottom: 2px !important;
                    min-height: 2.2em !important;
                    line-height: 1.2 !important;
                    white-space: normal !important;
                    word-break: break-word !important;
                    padding: 4px 2px 2px 2px !important;
                    text-align: center !important;
                    overflow: hidden !important;
                    text-overflow: ellipsis !important;
                }
                @media (max-width: 900px) {
                    .channel-item { flex: 0 1 48% !important; max-width: 48% !important; }
                }
                @media (max-width: 600px) {
                    .channel-item { flex: 0 1 98% !important; max-width: 98% !important; }
                }
                /* --- END FORCE FLEX MULTI-COLUMN CHANNEL GRID --- */
                /* Fancode: force 2 columns on all screens using flexbox fallback */
                @media (max-width: 900px) {
                    .tab-pane#external .channel-grid {
                        display: flex !important;
                        flex-wrap: wrap;
                        gap: 10px;
                        justify-content: flex-start;
                    }
                    .tab-pane#external .channel-item {
                        width: 48%;
                        margin-bottom: 10px;
                    }
                }
        /* Always at least 2 columns for Fancode tab (active/visible) */
        .tab-pane#external .channel-grid {
            min-width: 240px;
            grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        }
@import url('https://fonts.googleapis.com/css?family=Rambla:400i');

a {
    color: #ffffff;
    text-decoration: none;
    font-size: xx-large;
    font-family: cursive;
}

body {
  background: linear-gradient(to right, #0f2027, #203a43, #2c5364); /* Deep blue gradient */
  color: #ffffff; /* Clean white text for contrast */
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
}



a {
    cursor: pointer;
    font-size: 15px;
}

.tv-area { margin-top: 50px; }
.channel-list { padding-left: 0; max-height: 52vh; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.thumbnail-slider { margin:0; padding:0;  }
.thumbnail-slider li { list-style: none; margin-bottom: 10px; }
.thumbnail-slider li img { width: 100%; height: auto !important; border-radius: 5px; }


 .channel-list::-webkit-scrollbar {
 width: 12px;
 border-radius: 10px;
 background-color: #F5F5F5;
}
 .channel-list::-webkit-scrollbar-thumb {
 border-radius: 10px;
 -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
 background-color: #D62929;
}


 @media (max-width: 1199px) {
	 .channel-list { height: 425px; }
 }
 @media (max-width: 990px) {
 	  .channel-list { padding: 10px 15px; height: auto !important; overflow-y: auto; overflow-x: hidden; }
 	  .thumbnail-slider li { display: inline-block; margin: 0 5px 0 0; }
 	  .thumbnail-slider li a { display: block; width: 80px; }
 	}
@media (max-width: 410px) {
	.thumbnail-slider li a { width: 50px; }
}
:root {
            --primary-dark: #121212;
            --secondary-dark: #1E1E1E;
            --accent-dark: #BB86FC;
            --text-dark: #E1E1E1;
            
            --primary-light: #FFFFFF;
            --secondary-light: #F5F5F5;
            --accent-light: #6200EE;
            --text-light: #333333;
            
            --current-primary: var(--primary-dark);
            --current-secondary: var(--secondary-dark);
            --current-accent: var(--accent-dark);
            --current-text: var(--text-dark);
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            margin: 0;
            padding: 0;
            color: var(--current-text);
            background-color: var(--current-primary);
            transition: all 0.5s ease;
            min-height: 100vh;
        }

        /* Animated Background */
        .background {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            opacity: 0.1;
            background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
            background-size: 400% 400%;
            animation: gradient 15s ease infinite;
        }

        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        /* Theme Toggle */
        .theme-toggle {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1000;
            background: rgba(0,0,0,0.3);
            border-radius: 50px;
            padding: 5px;
            cursor: pointer;
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255,255,255,0.1);
            transition: all 0.3s ease;
        }

        .theme-toggle:hover {
            transform: scale(1.1);
        }

        .theme-toggle i {
            font-size: 1.5rem;
            padding: 10px;
            color: var(--current-text);
        }

        /* Main Container */
        .main-container {
            width: 80vw;
            max-width: 1600px;
            min-width: 320px;
            margin: 0 auto;
            padding: 30px;
            padding-top: 80px;
        }

        /* Player Section */
        .player-section {
            background-color: var(--current-secondary);
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            overflow: hidden;
            transition: all 0.3s ease;
            position: relative;
        }

        .player-section:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0,0,0,0.3);
        }

        /* Responsive Embed */
        .embed-container {
            position: relative;
            width: 100%;
            aspect-ratio: 16 / 9;
            overflow: hidden;
            background: #000;
        }

        /* Fallback for browsers without aspect-ratio support */
        @supports not (aspect-ratio: 16 / 9) {
            .embed-container {
                padding-bottom: 56.25%;
                height: 0;
            }
        }

        .embed-container video {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: none;
            display: block !important;
            visibility: visible !important;
            background: #000;
            border-radius: 0;
            margin: 0;
            padding: 0;
            object-fit: contain;
            max-width: 100vw;
            max-height: 100vh;
        }

        .embed-container iframe {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: none;
        }

        /* Mobile-specific fixes: ensure player visible on small screens */
        @media (max-width: 900px) {
            .main-player-area {
                height: auto !important;
                padding-top: 12px;
                min-height: 300px;
            }
            .player-section {
                padding: 16px !important;
                margin: 0 auto 12px auto;
            }
            .embed-container {
                position: relative;
                min-height: 200px; /* Ensure minimum visible height */
                overflow: hidden;
                width: 100% !important;
                max-width: 100vw;
            }
            
            /* Fallback for browsers without aspect-ratio support */
            @supports not (aspect-ratio: 16 / 9) {
                .embed-container {
                    padding-bottom: 56.25% !important;
                    height: 0;
                }
            }
            
            .embed-container video,
            .embed-container iframe,
            #mainVideo {
                position: absolute !important;
                top: 0 !important;
                left: 0 !important;
                width: 100% !important;
                height: 100% !important;
                object-fit: contain !important;
                display: block !important;
                visibility: visible !important;
            }
            #mainVideo {
                max-height: calc(100vh - 160px) !important;
            }
        }

        @media (max-width: 768px) {
            .embed-container {
                min-height: calc(100vw * 0.5625); /* 56.25% of viewport width */
            }
        }

        /* Player Info */
        .player-info {
            margin: 18px auto 0 auto;
            padding: 18px 28px 16px 28px;
            border-radius: 14px;
            max-width: 600px;
            position: static;
            text-align: center;
            transition: box-shadow 0.3s;
        }
        .player-info:hover {
            box-shadow: 0 8px 32px rgba(0,0,0,0.28);
        }

        .channel-title {
            font-size: 1.0rem;
            font-weight: 700;
            margin-bottom: 7px;
            color: #ffd700;
            letter-spacing: 0.5px;
        }

        .program-info {
            font-size: 1.0rem;
            opacity: 0.92;
            color: #fff;
            margin-bottom: 8px;
        }

        /* Channel List */
        .channel-list {
            background-color: var(--current-secondary);
            border-radius: 16px;
            padding: 20px;
            height: 100%;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }

        .channel-list-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
        }

        .channel-list-title {
            font-size: 1.5rem;
            font-weight: 600;
            margin: 0;
        }

        .channel-count {
            background-color: var(--current-accent);
            color: var(--current-primary);
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
        }


        /* Responsive multi-column grid for channel list below player */

        @media (max-width: 992px) {
            .channel-grid {
                grid-template-columns: repeat(2, 1fr) !important;
            }
        }

        @media (max-width: 768px) {
            .main-container {
                padding: 15px;
                padding-top: 70px;
            }
            .channel-grid {
                grid-template-columns: repeat(2, 1fr) !important;
                gap: 10px;
            }
            .channel-name {
                font-size: 0.8rem;
                padding: 5px;
            }
            .channel-list-title {
                font-size: 1.2rem;
            }
        }



        /* Light Theme */
        body.light-theme {
            --current-primary: var(--primary-light);
            --current-secondary: var(--secondary-light);
            --current-accent: var(--accent-light);
            --current-text: var(--text-light);
        }

        body.light-theme .channel-list {
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
        }

        body.light-theme .channel-item {
            background-color: rgba(0,0,0,0.03);
        }

        /* Footer */
        .footer {
            text-align: center;
            padding: 20px;
            margin-top: 40px;
            font-size: 0.9rem;
            opacity: 0.7;
            border-top: 1px solid rgba(255,255,255,0.1);
        }

        .footer a {
            color: var(--current-accent);
            text-decoration: none;
        }

        .footer a:hover {
            text-decoration: underline;
        }

        /* Responsive Adjustments */
        @media (max-width: 992px) {
            .channel-grid {
                grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
            }
        }

        @media (max-width: 768px) {
            .main-container {
                padding: 15px;
                padding-top: 70px;
            }
            
            .channel-grid {
                grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
                gap: 10px;
            }
            
            .channel-name {
                font-size: 0.8rem;
                padding: 5px;
            }
            
            .channel-list-title {
                font-size: 1.2rem;
            }
        }

        /* Custom scrollbar */
        .channel-grid::-webkit-scrollbar {
            width: 6px;
        }

        .channel-grid::-webkit-scrollbar-track {
            background: rgba(255,255,255,0.05);
            border-radius: 10px;
        }

        .channel-grid::-webkit-scrollbar-thumb {
            background: var(--current-accent);
            border-radius: 10px;
        }

        .channel-grid::-webkit-scrollbar-thumb:hover {
            background: rgba(187, 134, 252, 0.8);
        }
        /* ---------- Bootstrap layout overrides and helpers ---------- */
        .channel-list-scroll {
            max-height: calc(100vh - 220px);
            overflow-y: auto;
            overflow-x: hidden;
            padding-right: 6px;
        }
        /* Hide native scrollbars for channel list but keep scrolling functional */
        .channel-list-scroll {
            -ms-overflow-style: none; /* IE and Edge */
            scrollbar-width: none; /* Firefox */
        }
        .channel-list-scroll::-webkit-scrollbar {
            width: 0;
            height: 0;
            display: none;
        }

        /* Prefer Bootstrap sizing — subtle focus styles for the search control */
        .input-group-sm .form-control:focus {
            box-shadow: 0 0 0 0.12rem rgba(0,230,118,0.08);
            border-color: #00e676;
        }
        /* Place the clear (close) button inside the input */
        .search-input-wrap { position: relative; }
        .search-input { padding-right: 22px; }
        .search-close-inside {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            z-index: 6;
            background: transparent;
            border: none;
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            opacity: 0.95;
        }
        .search-close-inside:focus { outline: none; box-shadow: none; }
        /* Slightly nudge for very small screens */
        @media (max-width: 480px) {
            .search-input { padding-right: 40px; }
            .search-close-inside { right: 6px; width: 28px; height: 28px; }
        }
        /* Style the left search icon to blend with the theme */
        .search-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #cfd8dc;
            font-size: 1.05rem;
            padding: 0 8px 0 8px;
        }
        .search-input.ps-2 { padding-left: 0.6rem; }
        /* Make the input and icon appear as a single rounded control */
        .input-group .form-control {
            border-top-left-radius: 8px;
            border-bottom-left-radius: 8px;
        }
        .input-group .input-group-text {
            border-top-left-radius: 8px;
            border-bottom-left-radius: 8px;
            border-right: none;
            background: transparent;
        }

/* --- New search bar styling from user snippet --- */
.search-container {
    background-color: #ffffff;
    border-radius: 40px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    padding: 8px;
    width: 100%;
    transition: all 0.12s ease;
}
.search-container:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}
.form-control.search-input {
    border: none;
    background: transparent;
    padding-left: 6px;
    font-size: 10px;
    height: 12px;
    line-height: 12px;
}
.form-control.search-input:focus {
    box-shadow: none;
    outline: none;
}
.btn-search {
    background-color: #007bff;
    color: white;
    border-radius: 999px;
    padding: 0 6px;
    border: none;
    transition: all 0.12s ease;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}
.btn-search:hover {
    background-color: #0056b3;
    transform: none;
}
.search-icon {
    color: #6c757d;
}

@media (max-width: 480px) {
    .form-control.search-input { height: 28px; }
    .btn-search { padding: 6px 12px; }
}
        /* Make sure the close button in the input-group aligns vertically */
        .input-group .btn-close {
            margin: 0 6px 0 6px;
            align-self: center;
        }
        .channel-list-scroll .row {
            margin: 0;
        }
        .channel-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 8px;
            background: rgba(255,255,255,0.02);
            border-radius: 8px;
        }
        .channel-item .channel-thumbnail {
            width: 48px !important;
            height: 32px !important;
            object-fit: contain !important;
            margin: 0 !important;
        }
        .channel-item .channel-name {
            font-size: 0.85rem !important;
            margin: 0 !important;
            color: #fff !important;
        }

        /* Make video responsive */
        .embed-responsive {
            position: relative;
            width: 100%;
            padding-bottom: 56.25%; /* 16:9 */
            height: 0;
            overflow: hidden;
        }
        .embed-responsive video {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        /* Player info spacing */
        .player-info { padding: 8px 0 0 0; }

        /* Ensure footer sits after content */
        .footer { margin-top: 28px; }

        @media (max-width: 768px) {
            .channel-list-scroll { max-height: 36vh; }
            .channel-item .channel-name { font-size: 0.9rem !important; }
            /* Ensure single-column layout uses full width */
            .row.row-cols-1 > [class*="col-"] { flex: 0 0 100% !important; max-width: 100% !important; }
        }

        /* Responsive thumbnail sizing for new grid */
        @media (min-width: 1200px) {
            .channel-item .channel-thumbnail { width: 64px !important; height: 40px !important; }
            .channel-item .channel-name { font-size: 0.85rem !important; }
        }
        @media (min-width: 900px) and (max-width: 1199px) {
            .channel-item .channel-thumbnail { width: 56px !important; height: 36px !important; }
        }
        @media (min-width: 576px) and (max-width: 899px) {
            .channel-item .channel-thumbnail { width: 52px !important; height: 34px !important; }
        }
        @media (max-width: 575px) {
            .channel-item .channel-thumbnail { width: 44px !important; height: 28px !important; }
            .channel-item { padding: 6px 6px; }
        }

        /* Page margin and spacing improvements for better visibility */
        /* Keep site centered with comfortable gutters */
        .container {
            max-width: 1200px;
            padding-left: 12px !important;
            padding-right: 12px !important;
        }

        /* Slightly tighter card padding to bring content into view */
        .card {
            border-radius: 12px;
        }
        .card-body {
            padding: 14px !important;
        }

        /* Reduce overall vertical spacing to keep important UI above the fold */
        .player-section, .player-info {
            margin-bottom: 8px !important;
        }

        .channel-list-scroll {
            padding: 6px !important;
        }

        /* Make footer sit close to content without huge gap */
        .footer {
            margin-top: 18px !important;
            padding-top: 12px !important;
            padding-bottom: 12px !important;
        }

        /* Ensure footer spans full width and is visible */
        .footer {
            width: 100%;
            box-sizing: border-box;
        }

        @media (max-width: 768px) {
            .container { padding-left: 8px !important; padding-right: 8px !important; }
            .card-body { padding: 12px !important; }
            .channel-list-scroll { max-height: 40vh; }
        }
        /* --- Layout fixes --- */
        /* Ensure player info is visible and above other elements */
        .player-info {
            color: #eafcfb !important;
            position: relative !important;
            z-index: 6 !important;
        }

        /* Make embed responsive and avoid overflowing the main container */
        .main-player-area .embed-container,
        .main-player-area #mainVideo,
        .player-section .embed-container,
        .player-section #mainVideo {
            width: 100% !important;
            max-width: 100% !important;
            height: auto !important;
            max-height: calc(100vh - 220px) !important;
            display: block !important;
        }

        /* Prevent sidebar from forcing overflow on mid-wide viewports */
        .sidebar-channel-list {
            flex-shrink: 0 !important;
            max-width: 420px !important;
            width: 32% !important;
        }

        /* Cap embed width on very wide screens so channels don't overflow */
        @media (min-width: 1400px) {
            .main-player-area .embed-container {
                max-width: calc(100vw - 420px - 80px) !important;
            }
        }

/* ------------------ Fixed footer ------------------ */
/* Pin footer to bottom and add body padding so content isn't hidden */
:root {
    --footer-height: 64px;
}
body {
    padding-bottom: var(--footer-height);
}
.footer {
    position: fixed !important;
    left: 0;
    bottom: 0;
    width: 100%;
    height: var(--footer-height);
    box-sizing: border-box;
    z-index: 1200 !important;
    background: rgba(20,24,34,0.98) !important;
    padding: 12px 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.45);
}
@media (max-width: 576px) {
    :root { --footer-height: 88px; }
    body { padding-bottom: var(--footer-height); }
    .footer { height: var(--footer-height); padding-top: 10px; padding-bottom: 14px; }
}

/* Footer content tweaks */
.footer img {
    height: 28px;
    width: auto;
    display: block;
}
.footer .mt-2 { margin-top: 0 !important; }

@media (max-width: 576px) {
    .footer { flex-direction: column; gap: 8px; padding: 10px 12px; }
}

/* Override muted text color to requested blue */
.text-muted {
    color: #0d6efd !important;
}