/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a1628;
    --bg-secondary: #0f2140;
    --bg-card: #0f2140;
    --text-primary: #FC8416;
    --text-secondary: #ffaa55;
    --accent: #FC8416;
    --accent-light: #FC8416;
    --accent-glow: rgba(252, 132, 22, 0.3);
    --border: rgba(255, 255, 255, 0.15);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.5);
}

/* ===== Reset ===== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-primary);
    background: var(--bg-primary);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== Game Grid ===== */
#gamesGrid.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (min-width: 768px) {
    #gamesGrid.games-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
}

/* ===== Game Card Styles ===== */
.game-card {
    display: block;
    min-width: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
    .game-card:hover {
        transform: translateY(-4px);
    }
    .game-card:hover .game-card-image {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    }
    .game-card:hover .game-card-title {
        color: var(--text-primary);
    }
}

.game-card:active {
    transform: scale(0.95);
}

.game-card-image {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.25s ease;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.game-card-image img {
    display: block;
    width: 100%;
    min-width: 0;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    .game-card:hover .game-card-image img {
        transform: scale(1.05);
    }
}

.game-card-info {
    padding: 0;
}

.game-card-title {
    display: block;
    min-width: 0;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 28px;
    height: 28px;
    width: 100%;
}

@media (min-width: 768px) {
    .game-card-title {
        font-size: 14px;
        margin-top: 12px;
    }
}

/* ===== Skeleton Loading ===== */
.loading-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.loading-skeleton .skeleton-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-skeleton .skeleton-img {
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    background: linear-gradient(90deg, #0f2140 25%, #1a3a60 50%, #0f2140 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.loading-skeleton .skeleton-title {
    height: 18px;
    width: 80%;
    margin: 0 auto;
    border-radius: 4px;
    background: linear-gradient(90deg, #0f2140 25%, #1a3a60 50%, #0f2140 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Empty / Error States ===== */
.empty-state,
.error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
    letter-spacing: 1px;
}

.error-state {
    color: #ff6b6b;
}
