/* 全局重置与基础变量 */
:root {
    --bg-color: #0a0a0c;
    --panel-bg: rgba(20, 20, 25, 0.7);
    --neon-yellow: #fcee0a;
    --neon-cyan: #00f0ff;
    --text-main: #e0e0e0;
    --border-color: rgba(0, 240, 255, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Share Tech Mono', 'Noto Sans JP', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    background-image: linear-gradient(rgba(0,240,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.03) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* 💻 电脑端默认标准布局 */
.app-container {
    display: flex;
    flex-direction: row; 
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

.sidebar {
    width: 320px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.05);
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.glitch-text {
    color: var(--neon-yellow);
    font-size: 1.5rem;
    letter-spacing: 2px;
    text-shadow: 2px 0 0 red, -2px 0 0 blue;
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.channel-list::-webkit-scrollbar { width: 6px; }
.channel-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.channel-group { margin-bottom: 15px; }

.group-title {
    position: sticky;
    top: -15px;
    background: rgba(10, 10, 12, 0.95);
    color: var(--neon-cyan);
    padding: 8px 0;
    font-size: 0.9rem;
    letter-spacing: 1px;
    z-index: 10;
    margin-bottom: 10px;
    backdrop-filter: blur(5px);
    border-bottom: 1px dashed var(--border-color);
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.channel-item:hover { background: rgba(0, 240, 255, 0.1); border-color: var(--neon-cyan); }
.channel-item.active {
    background: rgba(252, 238, 10, 0.1);
    border-left: 4px solid var(--neon-yellow);
    border-color: var(--neon-yellow);
}

.ch-logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
    margin-right: 15px;
    padding: 2px;
}

.ch-name { font-size: 1.05rem; font-weight: 700; }

/* 🎬 播放器核心区域（重构防塌陷结构） */
.player-section {
    flex: 1;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.1);
    overflow: hidden;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}

#video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    outline: none;
    display: block; /* 始终保持 block，依靠遮罩层控制视觉效果 */
}

/* 绝对定位遮罩层 */
.no-signal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--neon-cyan);
    font-size: 1.5rem;
    z-index: 5;
    pointer-events: none; /* 播放时允许点到下面的视频控件 */
}

/* 当处于播放状态时，通过父级类名隐藏遮罩层 */
.video-container.playing .no-signal {
    display: none;
}

.no-signal span {
    animation: blink 2s infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* =========================================================
   📱 移动端自适应（颠倒流向，防止高度折叠）
========================================================= */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column-reverse; /* 颠倒顺序：主内容(播放器)到顶部，侧边栏(列表)到底部 */
        padding: 0;
        gap: 0;
    }

    .main-content {
        width: 100%;
        height: 35vh; /* 刚性锁定高度，绝不塌陷 */
        flex: none;
    }

    .player-section {
        border-radius: 0;
        border: none;
        border-bottom: 2px solid var(--border-color);
    }

    .sidebar {
        width: 100%;
        flex: 1;
        border-radius: 0;
        border: none;
    }

    .channel-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .ch-logo { width: 40px; height: 40px; }
    .ch-name { font-size: 1rem; }
}