/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a0a0a;
    min-height: 100vh;
    color: #fff;
    line-height: 1.6;
}

/* Header Styles */
.header {
    text-align: center;
    padding: 3rem 0 2rem 0;
    margin-bottom: 3rem;
}

.header h1 {
    color: #ffffff;
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: #888;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

/* Game Card Styles */
.game-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #333;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: #667eea;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.2);
}

.game-image-container {
    position: relative;
    overflow: hidden;
    background: #2a2a2a;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gif-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 2;
}

.game-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: all 0.3s ease;
    /* 确保GIF自动播放 */
    animation-play-state: running;
    /* 优化GIF加载 */
    image-rendering: auto;
    /* 防止GIF闪烁 */
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
}

.game-image.loaded {
    opacity: 1 !important;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.game-card:hover .game-image {
    transform: scale(1.02);
}

.game-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.game-tag {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.game-description {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    flex: 1;
}

.play-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.play-button:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.remix-button {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.5rem;
}

.remix-button:hover {
    background: #667eea;
    color: white;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Footer */
.footer {
    text-align: center;
    padding: 3rem 0;
    color: #666;
    border-top: 1px solid #333;
    margin-top: 4rem;
}

.add-game-section {
    text-align: center;
    margin: 3rem 0;
}

.add-game-button {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.add-game-button:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .header p {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .game-image {
        height: 160px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .remix-button {
        margin-right: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 2rem 0 1.5rem 0;
        margin-bottom: 2rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .game-content {
        padding: 1rem;
    }
    
    .game-title {
        font-size: 1.1rem;
    }
    
    .game-description {
        font-size: 0.85rem;
    }
    
    .add-game-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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