/* ========== 播放器容器样式 ========== */
#playerSection {
    display: none;
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* 播放器iframe */
#customPlayer {
    width: 100%;
    height: 600px;
    border: none;
    display: block;
}

/* 关闭按钮 */
.player-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    padding: 8px 16px;
    background: rgba(255, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.player-close-btn:hover {
    background: rgba(255, 0, 0, 0.9);
    transform: scale(1.05);
}

/* 线路按钮激活状态 */
.episode-item.active {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* 播放器加载动画 */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.player-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    animation: pulse 1.5s infinite;
    display: none;
    z-index: 10;
}

/* 播放器控制面板 */
.player-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s;
}

#playerSection:hover .player-controls {
    opacity: 1;
}

.control-btn {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* 响应式设计 */
@media (max-width: 768px) {
    #customPlayer {
        height: 400px;
    }
    
    .player-controls {
        flex-wrap: wrap;
        justify-content: center;
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    #customPlayer {
        height: 300px;
    }
    
    .player-close-btn {
        padding: 6px 12px;
        font-size: 12px;
        top: 10px;
        right: 10px;
    }
    
    .control-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 全屏样式 */
#playerSection.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    z-index: 9999;
    border-radius: 0;
}

#playerSection.fullscreen #customPlayer {
    height: 100vh;
}

/* 错误提示 */
.player-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff4444;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    max-width: 80%;
    display: none;
}

/* 播放器标题 */
.player-title {
    position: absolute;
    top: 15px;
    left: 15px;
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    border-radius: 4px;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 50;
}

/* 移动端播放器样式 */
#moviePlayer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: none;
}

/* 移动端控制层 */
.mobile-player-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

/* 左上角返回按钮（类似抖音/YouTube） */
.mobile-back-btn {
    position: absolute;
    top: env(safe-area-inset-top, 15px);
    left: 15px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 10001;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 悬浮关闭按钮（右下角） */
.float-close-btn {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 20px) + 80px);
    right: 20px;
    width: 56px;
    height: 56px;
    background: rgba(255, 0, 0, 0.8);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 10001;
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 顶部渐变遮罩 */
.player-top-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    pointer-events: none;
}

/* 仅移动端显示 */
@media (max-width: 768px) {
    .mobile-back-btn,
    .float-close-btn,
    .player-top-overlay {
        display: block;
    }
    
    .player-controls .player-close-btn {
        display: none; /* 隐藏原来的关闭按钮 */
    }
}

/* PC端保持原样 */
@media (min-width: 769px) {
    .mobile-back-btn,
    .float-close-btn,
    .player-top-overlay {
        display: none;
    }
}