#item-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 1.2rem 0.9rem;
    padding: 1.2rem;
    margin: 0 auto;
    max-width: 100%;
    width: 100%;
}

.item-card {
    border: 1.5px solid #232323;
    border-radius: 14px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    cursor: pointer;
    margin-bottom: 0.25rem;
    box-shadow: 0 4px 32px -8px rgba(0,0,0,0.45), 0 0 0 1.5px #232323;
    transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
    background: linear-gradient(160deg, #232323 0%, #181818 60%, #151515 100%);
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

/* Rarity-based gradient overlays */
.item-card[data-rarity="common"]::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(158,158,158,0.12) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.item-card[data-rarity="uncommon"] {
    border-color: rgba(70,211,123,0.3);
    box-shadow: 0 4px 32px -8px rgba(0,0,0,0.45), 0 0 0 1.5px rgba(70,211,123,0.25), 0 0 16px -8px rgba(70,211,123,0.15);
}

.item-card[data-rarity="uncommon"]::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(70,211,123,0.18) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.item-card[data-rarity="rare"] {
    border-color: rgba(52,217,255,0.35);
    box-shadow: 0 4px 32px -8px rgba(0,0,0,0.45), 0 0 0 1.5px rgba(52,217,255,0.3), 0 0 16px -8px rgba(52,217,255,0.2);
}

.item-card[data-rarity="rare"]::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(52,217,255,0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.item-card[data-rarity="epic"] {
    border-color: rgba(156,39,176,0.4);
    box-shadow: 0 4px 32px -8px rgba(0,0,0,0.45), 0 0 0 1.5px rgba(156,39,176,0.35), 0 0 18px -8px rgba(156,39,176,0.25);
}

.item-card[data-rarity="epic"]::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(156,39,176,0.22) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.item-card[data-rarity="legendary"] {
    border-color: rgba(255,179,71,0.45);
    box-shadow: 0 4px 32px -8px rgba(255,179,71,0.2), 0 0 0 1.5px rgba(255,179,71,0.4), 0 0 20px -8px rgba(255,179,71,0.3);
}

.item-card[data-rarity="legendary"]::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(255,179,71,0.26) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.item-card:hover {
    box-shadow: 0 8px 40px -8px #34d9ff55, 0 0 0 2px #34d9ff, 0 0 24px -4px rgba(52,217,255,0.35);
    border-color: #34d9ff;
    z-index: 2;
    transform: translateY(-2px);
}

/* Rarity-specific hover glows */
.item-card[data-rarity="uncommon"]:hover {
    box-shadow: 0 8px 40px -8px rgba(70,211,123,0.5), 0 0 0 2px #46d37b, 0 0 24px -4px rgba(70,211,123,0.4);
    border-color: #46d37b;
}

.item-card[data-rarity="rare"]:hover {
    box-shadow: 0 8px 40px -8px rgba(52,217,255,0.55), 0 0 0 2px #34d9ff, 0 0 24px -4px rgba(52,217,255,0.45);
    border-color: #34d9ff;
}

.item-card[data-rarity="epic"]:hover {
    box-shadow: 0 8px 40px -8px rgba(156,39,176,0.6), 0 0 0 2px #c770d6, 0 0 24px -4px rgba(156,39,176,0.5);
    border-color: #c770d6;
}

.item-card[data-rarity="legendary"]:hover {
    box-shadow: 0 8px 40px -8px rgba(255,179,71,0.65), 0 0 0 2px #ffb347, 0 0 28px -4px rgba(255,179,71,0.55);
    border-color: #ffb347;
}

.item-card img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 0;
    border-radius: 8px;
    background: #181818;
    border: 1px solid #232323;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.item-card .item-card-top {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    gap: 0.4rem;
    min-width: 0;
}

/* Ensure badges remain inside the item-card and enhance alignment */
.item-card .badges {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.32rem 0.32rem;
    align-items: center;
    align-content: flex-start;
    position: relative;
    z-index: 1;
    justify-content: flex-start;
    max-width: 100%;
    padding: 0.25rem 0.2rem 0.1rem 0.2rem;
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.25;
    flex: 0 1 64%;
    min-width: 0;
}

/* When badges are rendered as a direct child (below content), make them full-width */
.item-card > .badges,
.item-card > .badges-meta {
    width: 100%;
    flex: 0 0 auto;
    margin-top: 0.4rem;
}

/* Status badges (Quest/Hideout) positioned in top-right of the card top */
.item-card .badges-status {
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.24rem;
    max-width: 65%;
    justify-content: flex-end;
    align-items: flex-start;
    pointer-events: none; /* keep card fully clickable */
}

.item-card .badges-status .badge {
    pointer-events: auto; /* allow tooltip hover if needed */
}

.item-card-body {
    margin-top: 0.6rem;
    position: relative;
    z-index: 1;
    flex: 1;
    overflow: hidden;
}

.item-card .item-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.1rem;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
}

.item-desc {
    color: #666;
    font-size: 0.75rem;
    margin-top: 0.1rem;
    line-height: 1.2;
    position: relative;
    z-index: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-card-footer {
    display: none;
}

.view-btn {
    display: none;
}

.item-card .item-name {
    font-weight: bold;
}
