/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

/* Base Styles */
body {
    margin: 0;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #050505;
    color: #fff;
    transition: background .3s, color .3s;
    padding: 20px;
    height: 100vh;
    box-sizing: border-box;
    overflow-x: hidden;
}

:root {
    --bg: #050505;
    --text: #fff;
    --accent: #6366f1;
    --cyan: #00FFFF;
    --border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(10, 10, 15, 0.6);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --modal-bg: rgba(10, 10, 15, 0.95);
}

[data-theme="dark"] {
    --bg: #050505;
    --text: #fff;
}

/* Layout Container */
.layout-container {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 40px);
}

/* ==== SIDEBAR LEFT ==== */
.sidebar-left {
    width: 360px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(99, 102, 241, 0.15);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: var(--glass-border);
}

.sidebar-header h2 {
    margin: 0 0 16px 0;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
}

.header-pills {
    display: flex;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    line-height: normal;
}

.pill-git {
    background: var(--accent);
    color: #fff;
}

.pill-git:hover {
    background: #5558e3;
    transform: translateY(-1px);
}

.pill-dark {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: var(--glass-border);
}

.pill-dark:hover {
    background: rgba(255, 255, 255, 0.08);
}

.pill-p2p {
    background: #10b981;
    color: #fff;
    border: none;
}

.pill-p2p:hover {
    background: #0d9668;
}

.pill-p2p.off {
    background: #ef4444;
}

.pill-p2p.off:hover {
    background: #dc2626;
}

.pill-p2p.disabled {
    background: #6b7280;
    cursor: not-allowed;
    opacity: 0.7;
}

.pill-p2p.disabled:hover {
    background: #6b7280;
    transform: none;
}

.pill-lang {
    background: #f59e0b;
    color: #fff;
    border: none;
}

.pill-lang:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* Notice Banner (Ad Notice) */
.notice-banner {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    margin: 12px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 100;
}

[data-theme="dark"] .notice-banner {
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.95), rgba(25, 25, 30, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notice-wrap {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
}

.notice-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notice-content {
    flex: 1;
    min-width: 0;
}

.notice-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
}

[data-theme="dark"] .notice-title {
    color: #f9fafb;
}

.notice-text {
    font-size: 0.9rem;
    color: #4b5563;
    margin: 0 0 4px 0;
    line-height: 1.5;
}

[data-theme="dark"] .notice-text {
    color: #9ca3af;
}

.notice-thanks {
    font-size: 0.9rem;
    color: #6366f1;
    margin: 8px 0 0 0;
    font-weight: 600;
}

.notice-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.notice-close:hover {
    color: #6b7280;
}

/* Flash Notice (Toast) */
.flash-notice {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 9999;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    color: #fff;
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90vw;
    box-sizing: border-box;
}

.flash-notice.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.flash-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.flash-content svg {
    flex-shrink: 0;
    fill: #fff;
    margin-top: 2px;
}

.flash-content span {
    flex: 1;
    min-width: 200px;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    word-wrap: break-word;
}

.sidebar-search {
    padding: 16px 24px;
    border-bottom: var(--glass-border);
}

.sidebar-search input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: var(--glass-border);
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}

.sidebar-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

.sidebar-search input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.filter-pills {
    padding: 16px 24px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-bottom: var(--glass-border);
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    position: relative;
    z-index: 10;
    background: var(--glass-bg);
}

.filter-pills::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.filter-pill {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: var(--glass-border);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.filter-pill.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Channel List */
#channelList {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

#channelList::-webkit-scrollbar {
    width: 6px;
}

#channelList::-webkit-scrollbar-track {
    background: transparent;
}

#channelList::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#channelList::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.channel {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: var(--glass-border);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.channel:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(4px);
}

.channel.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent);
}

.channel img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 6px;
}

.ch-name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ch-epg {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ch-epg::before {
    content: "●";
    color: #ef4444;
    margin-right: 6px;
    font-size: 0.6rem;
}

.ch-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ==== MAIN CONTENT ==== */
.main-right {
    flex: 1;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(99, 102, 241, 0.15);
}

.player-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Allow scrolling content if needed */
}

.player-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    /* Limit height relative to view, but allow flex logic */
    max-height: 70vh;
    position: relative;
    background: #000;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    outline: none;
    background: #000;
    object-fit: contain;
}

/* Player Control Buttons */
.player-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: var(--glass-border);
}

.ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.ctrl-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.05);
}

.ctrl-btn:active {
    transform: scale(0.95);
}

/* Leaderboard Ad Banner */
.ad-leaderboard {
    display: flex;
    justify-content: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
}

/* Now Playing Section */
.now-playing-info {
    background: rgba(5, 5, 10, 0.8);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    border-top: var(--glass-border);
}

.now-playing-left {
    flex: 1;
    min-width: 0;
}

.now-playing-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.now-playing-channel {
    font-size: 2rem;
    font-weight: 800;
    color: var(--cyan);
    margin-bottom: 6px;
    line-height: 1;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.now-playing-live {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.now-playing-live span {
    color: #fff;
    font-weight: 600;
}

/* P2P Stats Panel */
.now-playing-right {
    flex: 0 0 auto;
    min-width: 280px;
    background: rgba(0, 0, 0, 0.85);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 16px;
}

.p2p-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: var(--glass-border);
}

.p2p-indicator {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

.p2p-text {
    color: #10b981;
    font-size: 0.9rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cyan);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Switch Toggle (For Dark Mode) */
.switch {
    display: none;
    /* Hidden because using button pill style */
}

/* ===== EXTRAS: Banner, Modal, VPN ===== */

/* Banner (Responsive Fixed) */
.cta-banner {
    background: linear-gradient(90deg, rgba(255, 239, 213, 0.9), rgba(255, 228, 225, 0.9));
    color: #222;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    position: relative;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .cta-banner {
    background: linear-gradient(90deg, rgba(42, 42, 42, 0.9), rgba(31, 31, 31, 0.9));
    color: #eee;
    border-bottom: var(--glass-border);
}

.cta-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.banner-text-block {
    flex: 1;
}

.banner-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.cta-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cta-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    padding: 0 8px;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal {
    width: min(560px, 92vw);
    background: var(--modal-bg);
    backdrop-filter: blur(20px);
    color: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    border: var(--glass-border);
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-body {
    display: grid;
    gap: 12px;
}

.addr {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    word-break: break-all;
    background: rgba(255, 255, 255, 0.03);
    font-family: 'JetBrains Mono', monospace;
}

.copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.copy-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: var(--glass-border);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.close-x {
    background: rgba(255, 255, 255, 0.1);
    border: var(--glass-border);
    color: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 1rem;
    line-height: normal;
}

.close-x:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* VPN Section */
.vpn-section {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.1);
}

/* VPN Row with Side Banners */
.vpn-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 20px;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 20px;
}

.vpn-row .vpn-section {
    flex: 1;
    max-width: 600px;
    margin: 0;
}



.vpn-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #fff;
}

.vpn-section p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

/* Footer */
footer {
    padding: 2rem 1rem;
    background: rgba(10, 10, 15, 0.4);
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    border-top: var(--glass-border);
}

footer .cta-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all .2s;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Rubik', sans-serif;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-ghost {
    background: transparent;
    color: inherit;
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
}

.lang-block {
    margin-top: 10px;
}

.lang-sep {
    height: 1px;
    border: 0;
    background: rgba(255, 255, 255, .15);
    margin: 10px auto;
    width: 200px;
}

/* ===== AD BANNERS ===== */
.ad-banner {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Side Banners 160x600 */
.ad-side {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    z-index: 100;
}

.ad-side-left {
    left: 10px;
}

.ad-side-right {
    right: 10px;
}

/* Sidebar Banner 300x250 */
.ad-sidebar {
    margin-top: 16px;
    flex-shrink: 0;
    padding: 16px;
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

/* Mobile Ad Row */
.ad-mobile-row {
    display: none;
    order: 0;
    width: 100%;
    padding: 8px;
    justify-content: center;
}

/* Sidebar Top Ad - Desktop only */
.ad-sidebar-top {
    margin-bottom: 16px;
    flex-shrink: 0;
    padding: 16px;
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

/* Desktop Leaderboard Bottom */
.ad-leaderboard-bottom {
    display: flex;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-top: 16px;
}

/* Mobile Rectangle Ad Below Stats */
.ad-mobile-rectangle {
    display: none;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-top: 16px;
}

/* Mobile Sticky Bottom Ad */
.ad-mobile-sticky {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    justify-content: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

/* Desktop with side ads - add padding to body */
@media (min-width: 1700px) {
    body {
        padding-left: 180px;
        padding-right: 180px;
    }
}

/* Hide side banners on smaller screens */
@media (max-width: 1700px) {
    .ad-side {
        display: none;
    }
}

/* Show mobile ads on mobile */
@media (max-width: 1200px) {
    .ad-mobile-row {
        display: flex;
    }

    .ad-sidebar,
    .ad-sidebar-top {
        display: none;
    }

    .ad-leaderboard-bottom {
        display: none;
    }

    .ad-mobile-rectangle {
        display: flex;
    }
}

/* Mobile sticky and padding for sticky ad */
@media (max-width: 900px) {
    .ad-mobile-sticky {
        display: flex;
    }

    /* Add bottom padding to body for sticky ad */
    body {
        padding-bottom: 70px;
    }
}


/* Responsive */
@media (max-width: 1200px) {
    .layout-container {
        flex-direction: column;
        height: auto;
    }

    .sidebar-left {
        width: 100%;
        height: auto;
        max-height: 500px;
    }

    .now-playing-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .now-playing-right {
        width: 100%;
        box-sizing: border-box;
    }

    body {
        height: auto;
        overflow-y: auto;
    }



    .vpn-row {
        flex-direction: column;
        padding: 0 10px;
    }

    .vpn-row .vpn-section {
        max-width: 100%;
    }


}

/* Mobile/Tablet/Small Laptop Specific */
@media (max-width: 1200px) {
    body {
        padding: 8px;
    }

    /* Compact Banners on mobile */
    .cta-banner {
        font-size: 0.8rem;
    }

    .cta-wrap {
        padding: 6px 10px;
        gap: 6px;
    }

    .banner-title {
        font-size: 0.8rem;
    }

    .cta-actions .btn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    /* Notice Banner Mobile */
    .notice-banner {
        margin: 8px;
        border-radius: 10px;
    }

    .notice-wrap {
        flex-direction: column;
        gap: 12px;
        padding: 12px 14px;
    }

    .notice-icon {
        width: 40px;
        height: 40px;
    }

    .notice-icon svg {
        width: 24px;
        height: 24px;
    }

    .notice-title {
        font-size: 0.9rem;
    }

    .notice-text {
        font-size: 0.8rem;
    }

    .notice-thanks {
        font-size: 0.8rem;
    }

    .notice-close {
        position: absolute;
        top: 10px;
        right: 10px;
        font-size: 1.2rem;
    }

    /* Flash Notice Mobile */
    .flash-notice {
        top: 10px;
        padding: 12px 16px;
        max-width: 95vw;
    }

    .flash-content {
        gap: 10px;
    }

    .flash-content svg {
        width: 20px;
        height: 20px;
    }

    .flash-content span {
        font-size: 0.85rem;
    }

    /* Layout container - column normal, we'll use order */
    .layout-container {
        flex-direction: column;
        gap: 8px;
    }

    /* Player FIRST on mobile */
    .main-right {
        order: -1;
        border-radius: 10px;
    }

    .player-wrapper {
        border-radius: 10px 10px 0 0;
        max-height: 35vh;
        aspect-ratio: 16/9;
    }

    /* Video player full size */
    #videoPlayer {
        border-radius: 10px 10px 0 0;
    }

    /* Now Playing compact */
    .now-playing-info {
        padding: 12px;
        gap: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .now-playing-label {
        font-size: 0.6rem;
        margin-bottom: 4px;
    }

    .now-playing-channel {
        font-size: 1.1rem;
    }

    .now-playing-live {
        font-size: 0.8rem;
    }

    /* P2P Stats compact */
    .now-playing-right {
        min-width: auto;
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .p2p-badge {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }

    .p2p-text {
        font-size: 0.8rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .stat-value {
        font-size: 0.75rem;
    }

    /* Sidebar SECOND on mobile */
    .sidebar-left {
        order: 1;
        width: 100%;
        max-height: 45vh;
        border-radius: 10px;
    }

    .sidebar-header {
        padding: 10px 12px;
    }

    .sidebar-header h2 {
        font-size: 0.75rem;
        margin-bottom: 8px;
        letter-spacing: 1px;
    }

    .header-pills {
        gap: 6px;
    }

    .pill {
        padding: 5px 10px;
        font-size: 0.7rem;
    }

    .pill svg {
        width: 12px;
        height: 12px;
    }

    .sidebar-search {
        padding: 8px 12px;
    }

    .sidebar-search input {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .filter-pills {
        padding: 12px 14px;
        /* More breathing room */
        gap: 10px;
        position: relative;
        z-index: 20;
        background: rgba(10, 10, 15, 0.98);
        overflow-x: auto;
        justify-content: flex-start;
        align-items: center;
        /* Ensure vertical centering */
        min-height: 50px;
        /* Ensure enough height */
    }

    .filter-pill {
        padding: 8px 16px;
        /* Larger touch target */
        font-size: 0.85rem;
        /* Readable text */
        flex-shrink: 0;
        white-space: nowrap;
        border-radius: 20px;
        line-height: 1.2;
    }

    #channelList {
        padding: 8px 12px;
    }

    .channel {
        padding: 8px;
        gap: 8px;
        border-radius: 8px;
        margin-bottom: 6px;
    }

    .channel img {
        width: 36px;
        height: 36px;
        border-radius: 6px;
        padding: 4px;
    }

    .ch-name {
        font-size: 0.8rem;
    }

    .ch-epg {
        font-size: 0.65rem;
    }

    /* VPN Section compact */
    .vpn-section {
        margin: 1rem auto;
        padding: 0.8rem;
    }

    .vpn-section h3 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .vpn-section p {
        font-size: 0.8rem;
        margin-bottom: 0.8rem;
    }

    /* Footer compact */
    footer {
        padding: 1rem 0.5rem;
        font-size: 0.8rem;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* Extra small mobile */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .now-playing-channel {
        font-size: 1rem;
    }

    .sidebar-header h2 {
        font-size: 0.65rem;
    }
}