:root { 
    --theme-color-pink: #e83d84; 
    --theme-color-purple: #a436a0; 
    --header-height-desktop: 70px; 
    --header-height-mobile: 60px; 
}

body { 
    background-color: #000000; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; 
    color: #ffffff; 
    margin: 0; 
    padding: 0; 
    overflow-x: hidden; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

#main { 
    flex: 1; 
}

header { 
    padding: 0 20px; 
    background: #0d0d0d; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    height: var(--header-height-desktop); 
    border-bottom: 3px solid var(--theme-color-purple); 
    box-shadow: 0 2px 10px rgba(0,0,0,0.5); 
}

.header-center { 
    flex-grow: 1; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100%; 
}

.header-logo { 
    max-height: 45px; 
    width: auto; 
    object-fit: contain; 
    cursor: pointer; 
}

.headerBtn { 
    width: 40px; 
    height: 40px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    border-radius: 50%; 
    background: rgba(255, 255, 255, 0.05); 
    cursor: pointer; 
    transition: 0.3s; 
    color: #fff; 
}

.headerBtn:hover { 
    background: rgba(255, 255, 255, 0.1); 
    color: var(--theme-color-pink); 
}

.headerBtn svg { 
    width: 24px; 
    height: 24px; 
    stroke: currentColor; 
}

.marquee-container { 
    width: 100%; 
    background: #e83d84; 
    color: #fff; 
    padding: 8px 0; 
    overflow: hidden; 
    position: sticky; 
    top: var(--header-height-desktop); 
    z-index: 998; 
    border-bottom: 2px solid #a436a0; 
    display: flex; 
    align-items: center; 
}

.marquee-container.hidden { 
    display: none !important; 
}

.marquee-text { 
    white-space: nowrap; 
    display: inline-block; 
    padding-left: 100%; 
    animation: marquee 25s linear infinite; 
    font-size: 13px; 
    font-weight: bold; 
}

@keyframes marquee { 
    0% { transform: translate(0, 0); } 
    100% { transform: translate(-100%, 0); } 
}

#searchBox { 
    display: none; 
    background: #111; 
    padding: 15px; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
}

#searchInput { 
    width: 100%; 
    max-width: 400px; 
    padding: 10px 20px; 
    border: 1px solid #333; 
    outline: none; 
    border-radius: 20px; 
    font-size: 15px; 
    background: #222; 
    color: #fff; 
    text-align: center; 
    margin: 0 auto; 
    display: block; 
}

#left { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    background-color: #000; 
    z-index: 99999; 
    flex-direction: column; 
    justify-content: center; 
}

#right { 
    width: 100%; 
    display: block; 
}

.channel-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); 
    gap: 15px; 
    justify-content: center; 
    padding: 15px; 
}

.channel-card { 
    background-color: #111111; 
    border: 2px solid var(--theme-color-pink); 
    border-radius: 15px; 
    padding: 15px 10px 10px; 
    text-align: center; 
    transition: 0.2s; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    position: relative; 
}

.channel-card:hover, .channel-card.active { 
    transform: scale(1.05); 
    border-color: var(--theme-color-purple); 
    box-shadow: 0 0 15px rgba(164, 54, 160, 0.5); 
    z-index: 10; 
}

.channel-logo-wrapper { 
    background-color: #ffffff; 
    width: 80px; 
    height: 80px; 
    border-radius: 50%; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    margin-bottom: 12px; 
    overflow: hidden; 
}

.channel-logo-wrapper img { 
    max-width: 85%; 
    max-height: 85%; 
    object-fit: contain; 
}

.channel-name { 
    font-size: 13px; 
    font-weight: bold; 
    color: #fff; 
    word-break: break-word; 
}

#videoWrap { 
    width: 100%; 
    height: 100%; 
    background: #000; 
    position: relative; 
    overflow: hidden; 
}

#video { 
    width: 100%; 
    height: 100%; 
}

video::-webkit-media-controls { 
    display: none !important; 
}

#videoWrap.aspect-fit video { object-fit: contain !important; }
#videoWrap.aspect-stretch video { object-fit: fill !important; }
#videoWrap.aspect-zoom video { object-fit: cover !important; transform: scale(1.2); }

#player-ui { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    opacity: 0; 
    transition: 0.3s; 
    z-index: 50; 
    pointer-events: none; 
}

#player-ui.visible { 
    opacity: 1; 
}

/* Zoned Player Top Bar */
#player-top-bar { 
    pointer-events: auto; 
    padding: 10px 15px; 
    background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent); 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: space-between; 
    align-items: center; 
    z-index: 100; 
}

.player-left { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    flex: 1; 
    min-width: 0; 
    max-width: 60%; 
}

.player-right { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    flex-shrink: 0; 
}

.p-btn { 
    background: transparent; 
    border: none; 
    color: white; 
    cursor: pointer; 
    padding: 6px; 
    display: flex; 
    border-radius: 50%; 
    transition: 0.2s; 
    pointer-events: auto; 
}

.p-btn:hover { 
    background: rgba(255,255,255,0.2); 
    color: var(--theme-color-pink); 
}

.p-btn svg { 
    width: 24px; 
    height: 24px; 
}

#p-num { 
    font-size: 18px; 
    font-weight: bold; 
}

#p-logo { 
    width: 32px; 
    height: 32px; 
    border-radius: 5px; 
    background: #fff; 
    padding: 2px; 
    object-fit: contain; 
}

/* Channel Name Smart Scroll */
.p-name-container { 
    flex: 1; 
    overflow: hidden; 
    white-space: nowrap; 
    position: relative; 
    display: flex; 
    align-items: center; 
}

.marquee-wrapper { 
    display: inline-block; 
    white-space: nowrap; 
}

#p-name { 
    display: inline-block; 
    font-size: 16px; 
    font-weight: bold; 
    text-shadow: 1px 1px 3px #000; 
    padding-right: 20px; 
}

.smart-scroll { 
    animation: scrollText 8s linear infinite alternate; 
}

@keyframes scrollText { 
    0% { transform: translateX(0); } 
    100% { transform: translateX(calc(-100% + 150px)); } 
}

/* ON-SCREEN NUMPAD (Mini Keyboard) */
#numpad-wrapper { 
    position: absolute; 
    bottom: 30px; 
    right: 20px; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; 
    pointer-events: auto; 
    z-index: 150; 
}

#numpad-toggle-btn { 
    background: rgba(232, 61, 132, 0.7); 
    border-radius: 50%; 
    width: 45px; 
    height: 45px; 
    border: 1px solid rgba(255,255,255,0.2); 
    color: #fff; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    cursor: pointer; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); 
    transition: 0.3s; 
    margin-top: 10px; 
}

#numpad-toggle-btn:hover { 
    background: var(--theme-color-pink); 
    transform: scale(1.1); 
}

#numpad-container { 
    background: rgba(15, 15, 20, 0.95); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px); 
    border: 1px solid rgba(255,255,255,0.1); 
    border-radius: 12px; 
    padding: 12px; 
    width: 220px; 
    box-shadow: 0 8px 25px rgba(0,0,0,0.8); 
    display: none; 
}

#numpad-container.visible { 
    display: block; 
}

.numpad-display { 
    background: #000; 
    border: 1px solid #333; 
    color: var(--theme-color-pink); 
    font-size: 24px; 
    font-weight: bold; 
    text-align: center; 
    border-radius: 8px; 
    margin-bottom: 12px; 
    height: 45px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    letter-spacing: 2px; 
}

.numpad-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 8px; 
}

.num-btn { 
    background: rgba(255,255,255,0.1); 
    border: none; 
    color: white; 
    font-size: 18px; 
    font-weight: bold; 
    padding: 12px 0; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: 0.2s; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

.num-btn:hover { 
    background: rgba(255,255,255,0.25); 
    color: var(--theme-color-pink); 
}

.num-btn.clear-btn { 
    background: rgba(255, 60, 60, 0.2); 
    color: #ff5555; 
}

.num-btn.ok-btn { 
    background: rgba(0, 230, 118, 0.2); 
    color: #00e676; 
}

#osd-indicator { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: rgba(0, 0, 0, 0.7); 
    color: white; 
    padding: 15px 25px; 
    border-radius: 12px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    pointer-events: none; 
    opacity: 0; 
    transition: opacity 0.2s ease; 
    z-index: 1010; 
    backdrop-filter: blur(5px); 
    -webkit-backdrop-filter: blur(5px); 
    border: 1px solid rgba(255,255,255,0.1); 
}

#osd-indicator.visible { 
    opacity: 1; 
}

#osd-icon { 
    color: #fff; 
    margin-bottom: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

#osd-text { 
    font-size: 16px; 
    font-weight: bold; 
    margin-bottom: 10px; 
    color: #fff; 
}

.osd-bar { 
    width: 120px; 
    height: 5px; 
    background: rgba(255,255,255,0.2); 
    border-radius: 3px; 
    overflow: hidden; 
}

#osd-fill { 
    height: 100%; 
    background: var(--theme-color-pink); 
    width: 50%; 
    transition: width 0.1s ease-out; 
}

#channel-input-overlay { 
    display: none; 
    position: absolute; 
    top: 25px; 
    left: 50%; 
    transform: translateX(-50%); 
    background: rgba(0, 0, 0, 0.75); 
    color: #ffffff; 
    font-size: 3rem; 
    font-weight: bold; 
    padding: 10px 30px; 
    border-radius: 15px; 
    z-index: 1003; 
    pointer-events: none; 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(5px); 
    -webkit-backdrop-filter: blur(5px); 
}

/* Settings Menu */
.settings-menu-container { 
    position: absolute; 
    top: 65px; 
    right: 20px; 
    background-color: rgba(28, 28, 28, 0.95); 
    border-radius: 8px; 
    padding: 8px 0; 
    width: 280px; 
    z-index: 999; 
    display: none; 
    flex-direction: column; 
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px); 
    border: 1px solid rgba(255,255,255,0.1); 
    pointer-events: auto; 
}

.settings-menu-container.visible { 
    display: flex; 
}

.menu-item { 
    display: flex; 
    align-items: center; 
    padding: 12px 15px; 
    cursor: pointer; 
    color: #f1f1f1; 
    transition: background-color 0.2s; 
    font-size: 0.95rem; 
}

.menu-item.disabled { 
    color: #777; 
    cursor: not-allowed; 
}

.menu-item:not(.disabled):hover { 
    background-color: rgba(255, 255, 255, 0.1); 
}

.menu-item svg { 
    width: 22px; 
    height: 22px; 
    margin-right: 15px; 
    color: #e0e0e0; 
}

.menu-item .label { 
    flex-grow: 1; 
}

.menu-item .value { 
    color: #aaa; 
}

.menu-item.active .value, .menu-item.active .label { 
    color: var(--theme-color-pink); 
    font-weight: bold; 
}

.menu-item .arrow { 
    margin-left: auto; 
    color: #aaa; 
    transform: rotate(0deg); 
    transition: transform 0.2s; 
    font-size: 20px; 
    line-height: 1;
}

.menu-item.back-item .arrow { 
    transform: rotate(180deg); 
}

.menu-item.back-item { 
    font-weight: bold; 
    padding-bottom: 8px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    margin-bottom: 5px; 
}

#splash-logo { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    pointer-events: none; 
    display: none; 
    z-index: 40; 
    opacity: 0; 
    transition: opacity 1.5s ease; 
    mix-blend-mode: screen; 
}

/* Sticky Ad Banner */
.sticky-ad-container { 
    position: fixed; 
    bottom: 0; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 100%; 
    background: #0b0f19; 
    border-top: 1px solid #1f2937;
    z-index: 9990; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    padding: 5px 0 10px 0; 
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

#close-ad-btn { 
    position: absolute; 
    top: -15px; 
    right: 10px; 
    background: #1f2937; 
    color: #fff; 
    border: 1px solid #374151; 
    border-radius: 50%; 
    width: 28px; 
    height: 28px; 
    font-size: 14px; 
    font-weight: bold; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

#close-ad-btn:hover { 
    background: var(--theme-color-pink); 
    border-color: var(--theme-color-pink); 
}

.ad-content { 
    width: 100%; 
    display: flex; 
    justify-content: center; 
    min-height: 50px; 
}

footer { 
    text-align: center; 
    padding: 20px 0; 
    margin-top: 30px; 
    background-color: #0d0d0d; 
    color: #cccccc; 
    font-size: 0.9rem; 
}

footer p { 
    margin: 0; 
}

/* Responsive */
@media (max-width: 768px) {
    .top-header { height: var(--header-height-mobile); padding: 0 10px; }
    .logo-container img { max-height: 38px; }
    .search-container { display: none; margin-left: 0; }
    #search-toggle-btn { display: flex; }
    .top-header.search-active { gap: 10px; justify-content: center; }
    .top-header.search-active .logo-container, .top-header.search-active #menu-toggle-btn, .top-header.search-active #search-toggle-btn, .top-header.search-active #refresh-button, .top-header.search-active .header-left-controls { display: none; }
    .top-header.search-active .search-container { display: flex; width: 100%; max-width: none; flex-grow: 0; position: relative; }
    .top-header.search-active .search-container input { padding-right: 40px; }
    .top-header.search-active #search-close-btn { display: flex; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); z-index: 5; }
    .top-header.search-active button.search-btn { display: none; }
    #menu-toggle-btn { margin-right: 0; }
    
    .marquee-container { top: var(--header-height-mobile); } 

    .channel-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); padding: 20px; gap: 15px; }
    .channel-logo-wrapper { width: 80px; height: 80px; }
    
    /* Mobile Player Layout */
    #player-top-bar { flex-wrap: wrap; padding: 10px; }
    .player-left { max-width: 50%; }
    .p-name-container { max-width: 140px; }
    #p-name { font-size: 15px; }
    #p-num { font-size: 16px; }
    .p-btn svg { width: 22px; height: 22px; }
    .player-right { gap: 10px; }
    #p-logo { width: 28px; height: 28px; }

    .settings-menu-container { top: 55px; right: 10px; width: 240px; }
    #numpad-wrapper { bottom: 20px; right: 15px; transform: scale(0.9); transform-origin: bottom right; }
}

@media (max-width: 576px) {
    .logo-container img { width: 120px; }
    .channel-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); padding: 15px; gap: 15px; }
    .channel-logo-wrapper { width: 70px; height: 70px; }
    .channel-name { font-size: 12px; }
    #nav-drawer { width: 260px; }
}

@media (max-width: 320px) {
    :root { var(--header-height-mobile): 45px; }
    
    .top-header { padding: 0 5px; }
    .logo-container img { max-height: 28px; width: auto; }
    .header-btn { width: 30px; height: 30px; }
    .header-btn svg { width: 18px; height: 18px; }
    
    #nav-drawer { width: 100vw; }
    .drawer-header { padding: 10px 15px; }
    .drawer-header .logo { width: 90px; }
    .drawer-menu li a { padding: 10px 15px; font-size: 13px; }
    
    .channel-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }
    .channel-card { padding: 10px 5px; border-radius: 12px; }
    .channel-logo-wrapper { width: 45px; height: 45px; margin-bottom: 8px; }
    .channel-name { font-size: 11px; line-height: 1.2; }
    
    .channel-card.active { transform: scale(1.05); box-shadow: 0 0 15px var(--theme-color-pink); border-width: 3px; }

    #player-top-bar { padding: 5px; }
    .p-name-container { max-width: 80px; }
    #p-logo { width: 20px; height: 20px; }
    #p-name { font-size: 12px; }
    .p-btn { padding: 4px; }
    .p-btn svg { width: 18px; height: 18px; }
    
    .settings-menu-container { width: 90vw; right: 5vw; top: 40px; }
    .menu-item { padding: 8px 10px; font-size: 12px; }
    
    #custom-modal, .resume-content { padding: 15px; width: 90vw; }
    #modal-title, #resume-channel-name { font-size: 1rem; margin-bottom: 10px; }
    #modal-text, .resume-subtext { font-size: 12px; margin-bottom: 15px; }
    #modal-ok-btn, #resume-play-btn, #modal-cancel-btn { padding: 8px 15px; font-size: 12px; }
    #resume-channel-logo { width: 50px; height: 50px; margin-bottom: 10px; }
    
    #numpad-wrapper { transform: scale(0.8); }
    .sticky-ad-container { transform: scale(0.75); transform-origin: bottom center; margin-bottom: -10px; }
}