/* 自定义动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease-out forwards;
}

/* 为Sprunki添加的扭曲效果动画 */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.glitch-effect:hover {
    animation: glitch 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
    color: #EC4899;
}

/* 自定义按钮悬停效果 */
.btn-hover-effect {
    transition: all 0.3s ease;
}

.btn-hover-effect:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 特色卡片悬停效果 */
.feature-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-5px);
}

/* 音乐波纹效果 */
.feature-card::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(236, 72, 153, 0.05) 50%, transparent 70%);
    opacity: 0;
    transform: scale(0.5);
    transform-origin: center;
    transition: all 0.5s ease;
    border-radius: 50%;
    pointer-events: none;
}

.feature-card:hover::after {
    opacity: 1;
    transform: scale(1);
}

/* 噪点效果叠加 */
.noise-overlay {
    position: relative;
}

.noise-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.05;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #6366F1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;
}

/* 移动设备优化 */
@media (max-width: 640px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* 渐变文本效果 */
.gradient-text {
    background: linear-gradient(to right, #6366F1, #8B5CF6, #EC4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* 音频视觉效果模拟 */
@keyframes audioWave {
    0% { height: 5px; }
    50% { height: 20px; }
    100% { height: 5px; }
}

.audio-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
}

.audio-wave span {
    display: inline-block;
    width: 3px;
    height: 5px;
    background-color: #6366F1;
    border-radius: 1px;
}

.audio-wave span:nth-child(1) { animation: audioWave 0.9s ease-in-out infinite; }
.audio-wave span:nth-child(2) { animation: audioWave 0.8s ease-in-out infinite 0.1s; }
.audio-wave span:nth-child(3) { animation: audioWave 1.2s ease-in-out infinite 0.2s; }
.audio-wave span:nth-child(4) { animation: audioWave 0.6s ease-in-out infinite 0.3s; }
.audio-wave span:nth-child(5) { animation: audioWave 0.8s ease-in-out infinite 0.4s; }

/* 恐怖风格文本效果 */
.horror-text {
    text-shadow: 0 0 5px rgba(236, 72, 153, 0.5);
    transition: all 0.3s ease;
}

.horror-text:hover {
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.8);
}

/* 游戏集合卡片样式 */
.aspect-w-16 {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 宽高比 */
}

.aspect-w-16 > * {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.game-card {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease;
}

.game-card:hover {
    transform: translateY(-4px);
}

.game-card .info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, 
        rgba(99, 102, 241, 0.8) 0%,
        rgba(139, 92, 246, 0.6) 20%,
        rgba(236, 72, 153, 0.4) 40%,
        transparent 70%
    );
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.game-card:hover .info-overlay {
    transform: translateY(0);
}

.game-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
}

.game-card p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

/* 性能优化样式 */
/* 图片懒加载样式 */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lazy-image.loaded {
    opacity: 1;
}

/* 减少布局偏移 (CLS) */
.game-card, .feature-card, .aspect-w-16 {
    min-height: 100px; /* 防止布局偏移 */
    contain: content; /* 提高渲染性能 */
}

/* 优化字体渲染 */
html {
    font-display: swap; /* 提高首次内容绘制速度 */
    text-rendering: optimizeSpeed; /* 加快文本渲染 */
}

/* 提高可读性比率，符合WCAG 2.1标准 */
.text-gray-600 {
    color: rgba(55, 65, 81, 0.95); /* 提高对比度 */
}

.text-gray-300 {
    color: rgba(209, 213, 219, 0.95); /* 提高对比度 */
}

/* 减少重绘和重排 */
.animate-fadeIn, .glitch-effect, .audio-wave span {
    will-change: transform, opacity;
    transform: translateZ(0); /* 启用GPU加速 */
}

/* 使用content-visibility提升页面加载性能 */
section:not(:first-child) {
    content-visibility: auto;
    contain-intrinsic-size: 1px 1000px; /* 预估尺寸 */
}

/* 优化移动端交互元素大小 */
@media (max-width: 640px) {
    .btn-hover-effect, a[href], button {
        min-height: 44px; /* 确保触摸目标足够大 */
        min-width: 44px;
        padding: 0.5rem 0.75rem;
    }
} 