* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background-color: #000000;
    overflow-x: hidden;
    position: relative;
}

/* 星空背景 */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: #ffffff;
    border-radius: 50%;
    animation: twinkle var(--duration) infinite;
    box-shadow: 0 0 4px #fff,
                0 0 8px #fff,
                0 0 12px #fff;
}

@keyframes twinkle {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* 视频容器 */
.video-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    margin-bottom: 120px;
}

/* 基础视频卡片样式 */
.video-card {
    position: relative;
    aspect-ratio: 9/16;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    padding: 2px;
    background: linear-gradient(
        45deg,
        #ff0000,
        #ff7f00,
        #ffff00,
        #00ff00,
        #0000ff,
        #4b0082,
        #8f00ff,
        #ff0000
    );
    background-size: 200% 200%;
    animation: rainbow-border 4s linear infinite;
}

.video-card::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: #000;
    border-radius: 6px;
    z-index: 0;
}

.video-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
    border-radius: 6px;
}

/* 添加彩虹边框动画 */
@keyframes rainbow-border {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 悬停效果增强 */
.video-card:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* 确保加载指示器在最上层 */
.loading-indicator {
    z-index: 2;
}

.video-card video.loaded {
    opacity: 1;
}

@keyframes rainbow-border {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* 播放状态样式 */
.video-card.playing {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    width: 45vh;
    height: 80vh;
    max-width: 90vw;
    max-height: 80vh;
    z-index: 2000;
    background: #000;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.video-card.playing video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    opacity: 1;
}

/* 移除遮罩层 */
/* body.video-playing::after {
    display: none;
} */

/* 移除播放状态的悬停效果 */
.video-card.playing:hover {
    transform: translate(-50%, -50%) !important;
}

/* 添加关闭提示 */
.video-card.playing::before {
    content: '点击关闭 或 按ESC';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.video-card.playing:hover::before {
    opacity: 1;
}

/* 响应式调整 */
@media screen and (max-width: 767px) {
    .video-card.playing {
        width: 90vw;
        height: 70vh;
    }
}

/* 标题样式 */
h1 {
    color: #ffffff;
    text-align: center;
    margin: 20px 0;
    position: relative;
    z-index: 1;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 2px;
    background: linear-gradient(
        90deg,
        #ff0000 0%,
        #ff7f00 14.28%,
        #ffff00 28.56%,
        #00ff00 42.84%,
        #0000ff 57.12%,
        #4b0082 71.4%,
        #8f00ff 85.68%,
        #ff0000 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow-text 6s linear infinite;
    text-shadow: none;
}

/* 添加彩虹文字动画 */
@keyframes rainbow-text {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: -200% center;
    }
}

/* 响应式布局 */
@media screen and (max-width: 767px) {
    /* 视频容器移动端样式 */
    .video-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
        margin-bottom: 100px;
    }
    
    /* 播放状态移动端样式 */
    .video-card.playing {
        top: 40%;
        height: 70vh;
        max-height: 70vh;
        margin-bottom: 100px;
    }
    
    /* 题移动端样式 */
    h1 {
        font-size: 1.5rem;
        margin: 15px 0;
        letter-spacing: 1px;
        background-size: 300% auto;
    }
    
    /* 页脚移动端样式 */
    footer {
        padding: 10px 0;
    }
    
    #currentTime {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .links {
        gap: 15px;
    }
    
    .links a {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}

/* 移除重复的 .video-container 定义 */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .video-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 6px;
    }
}

@media screen and (min-width: 1024px) {
    .video-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* 优化彩虹文字效果，避免重复定义 */
.rainbow-text, h1 {
    background: linear-gradient(
        90deg,
        #ff0000 0%,
        #ff7f00 14.28%,
        #ffff00 28.56%,
        #00ff00 42.84%,
        #0000ff 57.12%,
        #4b0082 71.4%,
        #8f00ff 85.68%,
        #ff0000 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow-text 6s linear infinite;
}

/* 移除重复的动画定义 */
@keyframes rainbow-text {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: -200% center;
    }
}

/* 修改页脚样式 */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2002;
}

/* 时间显示样式 */
#currentTime {
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 1px;
    color: #fff;
    -webkit-text-fill-color: initial;
}

/* 链接样式 */
.links {
    display: flex;
    justify-content: center;
    gap: 30px;
    align-items: center;
}

.links a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    -webkit-text-fill-color: initial;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    display: flex;
    align-items: center;
    gap: 6px;
}

.links a i {
    font-size: 1.1rem;
}

/* 悬停效果 */
.links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.links a:hover i {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

.separator {
    color: rgba(255, 255, 255, 0.3);
    -webkit-text-fill-color: initial;
}

.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ff4444;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    z-index: 10;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.error-message:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.05);
}

/* 加载中状态样式 */
.video-card.loading .error-message {
    color: white;
    background: rgba(0, 0, 0, 0.7);
}

.video-card.loading {
    position: relative;
}

.video-card.loading::after {
    content: "加载中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 4px;
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 2;
    text-align: center;
    font-size: 14px;
    white-space: nowrap;
    pointer-events: auto;
    cursor: default;
}

/* 添加加载动画 */
@keyframes loading-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading-indicator {
    animation: loading-pulse 1.5s infinite;
}

/* 玻璃态按钮样式 */
.glass-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    margin-right: 15px;
    outline: none;
}

.glass-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.glass-button:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.glass-button:not(:disabled):active {
    transform: translateY(0);
}

.glass-button.loading .reload-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 重新加载图标样式 */
.reload-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* 调整计数器容器样式 */
#videoCount {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    color: #fff;
}