/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 应用容器 ========== */
.app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

/* ========== 视频容器 ========== */
.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

/* ========== xgplayer 抖音风格定制 ========== */
/* 播放器根节点铺满容器 */
#player-container .xgplayer {
    width: 100% !important;
    height: 100% !important;
    background: #000;
}

/* 视频画面保持宽高比居中（与 videoFillMode: contain 配合） */
#player-container video {
    width: 100%;
    height: 100%;
    -o-object-fit: contain;
    object-fit: contain;
    background: #000;
}

/* 控制栏：去掉渐变底色，只留下贴底进度条（更接近抖音） */
#player-container .xgplayer-controls {
    background-image: none !important;
}

/* 中央大播放键（首次起播提示） */
#player-container .xgplayer-start {
    opacity: 0.92;
}

/* 自动恢复中隐藏错误提示：
   上游 CDN 文件失效时报"不支持的视频/或音频格式"，应用层会快速切换下一个源，
   恢复期间隐藏该提示避免闪现（连续全失败超限时不再隐藏，正常显示错误） */
#player-container .xgplayer-error.auto-recovering {
    display: none !important;
}

/* ========== 播放/暂停指示器 ========== */
.play-pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    -webkit-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
}

.play-pause-indicator.show {
    opacity: 1;
    -webkit-animation: indicator-fade 0.8s ease forwards;
    animation: indicator-fade 0.8s ease forwards;
}

/* 持续显示状态（等待用户点击播放时），不播放淡出动画 */
.play-pause-indicator.persistent {
    -webkit-animation: none;
    animation: none;
    opacity: 1;
}

.indicator-icon {
    width: 80px;
    height: 80px;
    fill: rgba(255, 255, 255, 0.9);
    -webkit-filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.play-pause-indicator.show-pause .play-icon {
    display: none;
}

.play-pause-indicator.show-pause .pause-icon {
    display: block;
}

.play-pause-indicator.show-play .play-icon {
    display: block;
}

.play-pause-indicator.show-play .pause-icon {
    display: none;
}

@-webkit-keyframes indicator-fade {
    0% {
        opacity: 1;
        -webkit-transform: translate(-50%, -50%) scale(0.8);
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 1;
        -webkit-transform: translate(-50%, -50%) scale(1.1);
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        -webkit-transform: translate(-50%, -50%) scale(1);
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes indicator-fade {
    0% {
        opacity: 1;
        -webkit-transform: translate(-50%, -50%) scale(0.8);
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 1;
        -webkit-transform: translate(-50%, -50%) scale(1.1);
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        -webkit-transform: translate(-50%, -50%) scale(1);
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ========== 顶部信息栏 ========== */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 10;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.top-stats {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    gap: 20px;
}

.stat-item {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.stat-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

/* ========== 右侧操作栏 ========== */
.right-actions {
    position: absolute;
    right: 16px;
    bottom: 120px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 24px;
    z-index: 10;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.action-item {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
}

.action-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.action-btn svg {
    width: 24px;
    height: 24px;
    fill: #fff;
    -webkit-transition: fill 0.3s ease;
    transition: fill 0.3s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
}

.action-btn:active {
    -webkit-transform: scale(0.95);
    transform: scale(0.95);
}

.action-btn.active {
    background: rgba(254, 44, 85, 0.3);
}

.action-btn.active svg {
    fill: #FE2C55;
}

.action-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* 头像样式 */
.avatar-item {
    position: relative;
}

.avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: -webkit-linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar-follow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: #FE2C55;
    border-radius: 50%;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    border: 2px solid #000;
}

/* 点赞/不喜欢动画 */
@-webkit-keyframes pulse-like {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.2);
        transform: scale(1.2);
    }
}

@keyframes pulse-like {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.2);
        transform: scale(1.2);
    }
}

@-webkit-keyframes pulse-dislike {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.2);
        transform: scale(1.2);
    }
}

@keyframes pulse-dislike {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.2);
        transform: scale(1.2);
    }
}

.action-btn.animating {
    -webkit-animation: pulse-like 0.4s ease;
    animation: pulse-like 0.4s ease;
}

#dislikeBtn.animating {
    -webkit-animation: pulse-dislike 0.4s ease;
    animation: pulse-dislike 0.4s ease;
}

/* 数字动画 */
@-webkit-keyframes number-bounce {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.3);
        transform: scale(1.3);
    }
}

@keyframes number-bounce {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.3);
        transform: scale(1.3);
    }
}

.action-count.animating {
    -webkit-animation: number-bounce 0.4s ease;
    animation: number-bounce 0.4s ease;
    display: inline-block;
}

/* ========== 底部信息栏 ========== */
.bottom-info {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 80px;
    padding: 20px;
    background: -webkit-linear-gradient(bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 10;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.source-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.source-meta {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    gap: 12px;
    font-size: 14px;
}

.source-category {
    color: rgba(255, 255, 255, 0.8);
}

.source-stability {
    color: rgba(255, 255, 255, 0.6);
}

/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
    .top-bar {
        padding: 12px 16px;
    }
    
    .stat-item {
        font-size: 13px;
    }
    
    .right-actions {
        right: 12px;
        bottom: 100px;
        gap: 20px;
    }
    
    .action-btn {
        width: 44px;
        height: 44px;
    }
    
    .action-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .avatar-circle {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .bottom-info {
        right: 70px;
        padding: 16px;
    }
    
    .source-name {
        font-size: 16px;
    }
    
    .source-meta {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 10px 12px;
    }
    
    .top-stats {
        gap: 16px;
    }
    
    .stat-item {
        font-size: 12px;
    }
    
    .stat-item svg {
        width: 14px;
        height: 14px;
    }
    
    .right-actions {
        right: 10px;
        bottom: 90px;
        gap: 18px;
    }
    
    .action-btn {
        width: 40px;
        height: 40px;
    }
    
    .action-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .avatar-circle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .avatar-follow {
        width: 18px;
        height: 18px;
        font-size: 14px;
    }
    
    .action-count {
        font-size: 11px;
    }
    
    .bottom-info {
        right: 60px;
        padding: 14px;
    }
    
    .source-name {
        font-size: 15px;
        margin-bottom: 6px;
    }
    
    .source-meta {
        font-size: 12px;
        gap: 10px;
    }
}

/* ========== 错误页面样式 ========== */
.error {
    max-width: 400px;
    padding: 40px 20px;
    text-align: center;
}

.error h1 {
    font-size: 24px;
    margin-bottom: 16px;
    color: #fff;
}

.error p {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

.error code {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}
