:root {
    --primary: #6a11cb;
    --secondary: #2575fc;
    --accent: #ff5e62;
    --light: #f8f9fa;
    --dark: #212529;
    --text: #333;
    --text-light: #fff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --font-stack: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* 新增字体变量 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-stack); /* 使用字体变量 */
}

body {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 30px;
}

.logo {
    /* --- 改进点：使用 Flexbox 实现图片和文字完美垂直居中 --- */
    display: flex;
    align-items: center;
    /* ------------------------------------------------ */
    
    font-size: 28px;
    font-weight: 800;
    color: var(--text-light);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.logo-image {
    width: 50px;
    height: 50px;
    /* 移除 vertical-align: middle; 因为父级 flexbox 已处理对齐 */
    margin-right: 10px;
    /* 可以添加 object-fit: cover; 确保图片在框内正确显示 */
    object-fit: cover;
}

.logo span {
    color: var(--accent);
}

.search-bar {
    display: flex;
    width: 300px;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 25px 0 0 25px;
    outline: none;
    font-size: 14px;
}

.search-bar button {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    transition: var(--transition);
}

.search-bar button:hover {
    background: #ff3b4a;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.game-display {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.game-frame-container {
    position: relative;
    height: 400px;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../images/game-placeholder.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.game-frame-overlay {
    text-align: center;
    z-index: 2;
}

.play-button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 20px;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(255, 94, 98, 0.4);
}

.play-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 94, 98, 0.6);
}

.game-details {
    padding: 25px;
}

.section-title {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 5px;
}

.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.game-description,
.game-features {
    background: var(--light);
    padding: 15px;
    border-radius: 10px;
}

.game-features ul {
    padding-left: 20px;
}

.game-features li {
    margin-bottom: 8px;
}

.community-reviews {
    margin-top: 20px;
}

.review {
    background: var(--light);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.review-rating {
    color: #ffc107;
}

.games-list {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 20px;
    max-height: 800px;
    overflow-y: auto;
}

.games-list h2 {
    margin-bottom: 20px;
    color: var(--primary);
    text-align: center;
}

.game-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid #eee;
}

.game-item:hover {
    background: var(--light);
    transform: translateX(5px);
}

.game-item.active {
    background: linear-gradient(to right, rgba(106, 17, 203, 0.1), rgba(37, 117, 252, 0.1));
    border-left: 4px solid var(--primary);
}

.game-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: #ddd;
    margin-right: 15px;
    overflow: hidden;
}

.game-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.game-category {
    font-size: 12px;
    color: #666;
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.category-tag {
    background: var(--light);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--primary);
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    text-align: center;
}

footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    color: var(--text-light);
    font-size: 14px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .games-list {
        max-height: 400px;
    }
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 15px;
    }

    .search-bar {
        width: 100%;
    }

    .game-info {
        grid-template-columns: 1fr;
    }
}

/* Animation Effects */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}