/* 游戏库容器 */
.game-library {
    width: 100%;
    padding: 10px 0;
}

/* 网格布局 - 使用CSS变量控制列数 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 5), 1fr);
    gap: 15px;
}

/* 游戏卡片 */
.game-card {
    background: var(--theme-item-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

/* 游戏图片 - 调整宽高比（更宽更矮） */
.game-image {
    position: relative;
    padding-top: 40%; /* 调整为宽高比约5:2（原16:9），更宽更矮 */
    overflow: hidden;
}

.game-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.game-card:hover .game-thumb {
    transform: scale(1.05);
}

/* 游戏信息区域 */
.game-info {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 游戏标题 - 一行显示 */
.game-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    line-height: 1.4;
    height: 1.4em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.game-title a {
    color: var(--theme-font-color);
    text-decoration: none;
}

.game-title a:hover {
    color: var(--theme-color);
    text-decoration: underline;
}

/* 游戏元数据（评分和分类）- 关键修复 */
.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--theme-gray-color);
    width: 100%;
    min-width: 0;
}

/* 评分容器 - 确保不会挤压 */
.game-rating {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 5px;
}

.game-rating:before {
    content: "★";
    color: #ffb800;
    margin-right: 3px;
}

/* 分类容器 - 自动省略 */
.game-category {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-category:before {
    content: "📁";
    margin-right: 2px;
}

/* 无游戏提示 */
.no-games {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--theme-gray-color);
    background: var(--theme-item-bg);
    border-radius: 8px;
    border: 1px dashed var(--theme-border-color);
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .game-grid {
        --columns: 4 !important;
    }
}

@media (max-width: 992px) {
    .game-grid {
        --columns: 3 !important;
    }
}

@media (max-width: 768px) {
    .game-grid {
        --columns: 2 !important;
        gap: 10px;
    }
    .game-image {
        padding-top: 45%;
    }
}

/* 手机端优化 */
@media (max-width: 576px) {
    .game-grid {
        --columns: 2 !important;
        gap: 8px;
    }
    .game-title {
        font-size: 13px;
        margin-bottom: 4px;
    }
    .game-image {
        padding-top: 50%;
    }
    .game-meta {
        font-size: 11px;
    }
    .game-info {
        padding: 6px;
    }
    /* 手机端元数据特殊处理 */
    .game-rating {
        font-size: 10px;
        margin-right: 3px;
    }
    .game-category {
        font-size: 10px;
    }
}

/* 极小屏幕额外适配 */
@media (max-width: 375px) {
    .game-meta {
        flex-wrap: wrap;
        gap: 3px;
    }
    .game-rating, .game-category {
        width: 100%;
        justify-content: space-between;
    }
}

/* 暗色主题适配 */
[data-theme="dark"] .game-card {
    background: var(--theme-dark-item);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="dark"] .game-title a {
    color: var(--theme-dark-font-color);
}

[data-theme="dark"] .game-meta {
    color: var(--theme-dark-gray-color);
}

[data-theme="dark"] .no-games {
    background: var(--theme-dark-item);
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-gray-color);
}