body {
    font-family: Arial, sans-serif;
    text-align: center;
    padding: 20px;
    background-image: linear-gradient(45deg, #737884 33.33%, #949aaa 33.33%, #b5bcd0 66.66%, #d6def6 66.66%);
    background-size: 200% 200%;
    animation: backgroundAnimation 20s linear infinite alternate;
}

@keyframes backgroundAnimation {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

h1 {
    color: #0099ff;
    font-size: 28px;
    margin-bottom: 30px;
    transition: color 0.3s ease;
}

.item-selection {
    margin: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.4);
    transition: background-color 0.3s ease;
    position: relative;
    animation: itemSelectionEnter 0.5s ease;
}

@keyframes itemSelectionEnter {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.expand-button {
    cursor: pointer;
    font-size: 24px;
    margin-right: 10px;
    position: absolute;
    top: 10px;
    right: 10px;
    color: #333;
}

.items {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.item {
    text-align: center;
    cursor: pointer;
    width: 150px;
    animation: itemEnter 0.5s ease;
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
}

.item:hover {
    transform: scale(1.05);
}

.item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 1px solid #ccc;
    border-radius: 10px;
    margin-bottom: 10px;
}

.item-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.item-controls button {
    background-color: #3498db;
    color: white;
    font-size: 16px;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border-radius: 5px;
}

.item-controls button:hover {
    background-color: #2980b9;
}

.item-controls button:active {
    transform: scale(0.95);
}

.item-quantity {
    width: 40px;
    height: 30px;
    font-size: 16px;
    text-align: center;
    border: 1px solid #ccc;
    margin: 0 5px;
}

@keyframes itemEnter {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

#cost-list {
    list-style: none;
    padding: 0;
}

#cost-list li {
    margin-top: 10px;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

#cost-list li::before {
    content: attr(data-item);
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

#cost-list li::after {
    content: attr(data-cost);
    white-space: pre-wrap; 
}

@keyframes costItemEnter {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.expand-button {
    cursor: pointer;
    font-size: 24px;
    margin-right: 10px;
    position: relative;
}

.item-selection.expanded .items {
    display: flex;
}

.item-selection .items {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.total-upgrade-cost {
    margin-top: 20px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.4);
    animation: totalCostEnter 0.5s ease;
    position: relative;
}

#total-cost-list {
    list-style: none;
    padding: 0;
}

#total-cost-list li {
    margin-top: 10px;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

#total-cost-list li::before {
    content: attr(data-item);
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

#total-cost-list li::after {
    content: attr(data-cost);
    white-space: pre-wrap; 
}

.total-cost {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 18px;
}
