/* --- Game Cards & Components --- */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.game-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(140, 82, 255, 0.2);
    border-color: rgba(140, 82, 255, 0.3);
}

.game-visuals {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: var(--skeleton-color);
}

/* Default aspect ratio for standard grid items to prevent collapse */
.games-grid .game-visuals {
    aspect-ratio: 16 / 10;
}

/* For top games, they fill the grid row height naturally */
.top-games-grid .game-visuals {
    height: 100%;
}

.game-visuals img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s cubic-bezier(0.2, 0, 0.2, 1);
}

.game-card:hover .game-visuals img {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 15, 26, 0.95) 0%, rgba(15, 15, 26, 0.4) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-card:hover .card-overlay {
    opacity: 1;
}

.game-title {
    font-weight: 700;
    font-size: 1.1em;
    color: white;
    margin-bottom: 12px;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.play-button-overlay {
    background: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition-delay: 0.05s;
}

.game-card:hover .game-title,
.game-card:hover .play-button-overlay {
    transform: translateY(0);
}

.favorite-button {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: rgba(15, 15, 26, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.favorite-button:hover {
    transform: scale(1.1);
    background: rgba(15, 15, 26, 0.8);
    opacity: 1;
}

.favorite-button.favorited {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.15);
    border-color: rgba(255, 71, 87, 0.3);
    opacity: 1;
}

.new-tag {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75em;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.3);
}

/* Category Slider */
.category-container {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 5px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-container::-webkit-scrollbar {
    display: none;
}

.category-button {
    padding: 10px 24px;
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color-muted);
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.category-button:hover {
    background: var(--input-bg-color);
    color: var(--text-color);
    transform: translateY(-2px);
}

.category-button.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(140, 82, 255, 0.3);
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-color) 25%, #2d2d4d 50%, var(--skeleton-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 20px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    aspect-ratio: 16 / 10;
    width: 100%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal {
    background: var(--modal-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

.modal h2 {
    font-size: 1.8em;
    margin-bottom: 24px;
    text-align: center;
}

.modal input {
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 16px;
    background: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1em;
    transition: all 0.3s ease;
}

.modal input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(140, 82, 255, 0.1);
    outline: none;
}

.modal button {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: white;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1em;
    transition: all 0.3s ease;
}

.modal button:hover {
    background: var(--accent-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(140, 82, 255, 0.3);
}

/* Section Titles */
.section-title {
    font-size: 2.2em;
    font-weight: 800;
    margin: 60px 0 30px 0;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title::before {
    content: '';
    width: 8px;
    height: 32px;
    background: var(--accent-color);
    border-radius: 4px;
}