/* 弹窗广告样式 */
#adPopup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85) !important;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0; /* 默认完全透明 */
    pointer-events: none; /* 默认不接受事件 */
    display: flex !important; /* 确保始终占据布局位置 */
}

#adPopup.active {
    opacity: 1; /* 显示时完全不透明 */
    pointer-events: auto; /* 接受所有事件 */
}

.ad-container {
    position: relative;
    width: 85%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    transform: scale(0.95); /* 初始缩放以配合动画 */
    transition: transform 0.5s ease-out;
}

#adPopup.active .ad-container {
    transform: scale(1); /* 动画结束时恢复原大小 */
}

.ad-image {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.3s ease;
}

.ad-image:hover {
    transform: scale(1.02);
}

.ad-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

.ad-button {
    background: rgba(255, 255, 255, 0.9);
    color: #0a5e9c;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.ad-button:hover {
    background: white;
    transform: translateY(-3px);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: white;
    transform: rotate(90deg);
}

.ad-timer {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #0a5e9c;
    padding: 5px 15px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .ad-container {
        width: 95%;
    }
}