.item{
  width: min-content;
}
.img-item {
  background-color: #afafaf;
  background-image: -moz-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
  background-image: -webkit-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
  background-image: -ms-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
  max-height: 120px;
  max-width: 120px;
  /* พิจารณาตั้ง height/width ที่แน่นอน ถ้า height: 100% ไม่ทำงานตามคาด */
  height: 120px; /* ตัวอย่าง: กำหนดค่าคงที่ */
  width: 120px;  /* ตัวอย่าง: กำหนดค่าคงที่ */
  position: relative; /* จำเป็นสำหรับ absolute positioning ของ span */
  /* justify-content และ align-content ไม่มีผลถ้า display ไม่ใช่ flex หรือ grid */
  /* ถ้าต้องการจัดกลางเนื้อหาจริงๆ ให้ใช้ display: flex; justify-content: center; align-items: center; */
  display: flex; /* เพิ่มเพื่อให้ justify/align ทำงาน */
  justify-content: center;
  align-items: center;
  margin: auto;
  border-radius: 20px 10px 20px 10px;
  overflow: hidden; /* <<< เพิ่มบรรทัดนี้ */
  border: 2px solid #afafaf;
}
.img-item img{
  width: 85px;
  height: 85px;
}
.img-item.unique{
  background-color: #c58fff;
  background-image: -moz-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(255,234,255) 100%);
  background-image: -webkit-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(255,234,255) 100%);
  background-image: -ms-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(255,234,255) 100%);
  border: 2px solid #c58fff;
  box-shadow: 0 0 10px #e4caff, 0 0 10px #e4caff;
  border: 2px solid #c58fff;
}
.img-item.epic{
  background-color: #ffc532;
  background-image: -moz-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(255,249,222) 100%);
  background-image: -webkit-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(255,249,222) 100%);
  background-image: -ms-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(255,249,222) 100%);
  border: 2px solid #ffc532;
  box-shadow: 0 0 10px #ffe5a4, 0 0 10px #ffe5a4;
  border: 2px solid #ffc532;
}
.img-item.rare{
  background-color: #41a9ff;
  background-image: -moz-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(195,246,255) 100%);
  background-image: -webkit-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(195,246,255) 100%);
  background-image: -ms-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(195,246,255) 100%);
  border: 2px solid #41a9ff;
  box-shadow: 0 0 10px #9ad2ff, 0 0 10px #9ad2ff;
  border: 2px solid #41a9ff;
}
.img-item.uncommon{
  border-color: #18a821;
  background-image: -moz-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(207,255,232) 100%);
  background-image: -webkit-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(207,255,232) 100%);
  background-image: -ms-linear-gradient( 90deg, rgb(255,255,255) 0%, rgb(207,255,232) 100%);
  border: 2px solid #18a821;
  box-shadow: 0 0 10px #64e96d, 0 0 10px #64e96d;
  border: 2px solid #18a821;
}
.info-icon{
  position: absolute;
  z-index: 99;
}
.btn-info-icon{
  --bs-btn-color: #797979 !important;
  --bs-btn-bg: tranparent !important ;
  --bs-btn-border-color: tranparent !important;
  --bs-btn-hover-color: #9e9e9e !important;
  --bs-btn-hover-bg: tranparent !important;
  --bs-btn-hover-border-color: tranparent !important;
  --bs-btn-focus-shadow-rgb: 130, 138, 145 !important;
  --bs-btn-active-color: #9e9e9e !important;
  --bs-btn-active-bg: text-align !important;
  --bs-btn-active-border-color: tranparent !important;
  --bs-btn-active-shadow: inset 0 3px 5px tranparent !important;
  --bs-btn-disabled-color: #9e9e9e !important;
  --bs-btn-disabled-bg: tranparent !important;
  --bs-btn-disabled-border-color: tranparent !important;
  position: absolute !important;
  right: 0px !important;
  top: 0px !important;
  padding: 5px !important;
}
.btn-info-icon:hover{
  color: #9e9e9e !important;
}
.quantity-item{
  position: absolute;
  right: 0px;
  bottom: 0px;
  padding: 5px;
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #838383;
}
.name-item{
  font-size: 14px;
  font-weight: 400;
  color: #4a4237;
  margin-top: 10px;
  margin-bottom: 20px;
  /* text-shadow: 0 0 10px #000; */
}
/* --- สไตล์และ Animation ของ Span (เหมือนเดิม) --- */
.img-item span {
  position: absolute;
  display: block;
}
.img-item.unique span {
  position: absolute;
  display: block;
  box-shadow: 0 0 5px #c786ff, 0 0 10px #c786ff;
}
.img-item.epic span {
  position: absolute;
  display: block;
  box-shadow: 0 0 5px #ffb700, 0 0 10px #ffb700;
}
.img-item.rare span {
  position: absolute;
  display: block;
  box-shadow: 0 0 5px #008cff, 0 0 10px #008cff;
}
.img-item.uncommon span {
  position: absolute;
  display: block;
  box-shadow: 0 0 5px #18a821, 0 0 10px #18a821;
}
/* Top Edge */
.img-item span:nth-child(1) {
  height: 3px;
  width: 100%;
  top: -3px;
  left: -100%;
  border-top-right-radius: 1px;
  border-bottom-right-radius: 1px;
  animation: span1 2s linear infinite;
  animation-delay: 1s;
}
.img-item.unique span:nth-child(1) {
  background: linear-gradient(to right, rgba(0,0,0,0), #c786ff);
}
.img-item.epic span:nth-child(1) {
  background: linear-gradient(to top, rgba(0,0,0,0), #ffc532);
}
.img-item.rare span:nth-child(1) {
  background: linear-gradient(to top, rgba(0,0,0,0), #008cff);
}
.img-item.uncommon span:nth-child(1) {
  background: linear-gradient(to top, rgba(0,0,0,0), #18a821);
}
@keyframes span1 {
  0% {
      left: -100%;
  }
  100% {
      left: 100%;
  }
}

/* Right Edge */
.img-item span:nth-child(2) {
  height: 100%;
  width: 3px;
  top: -100%;
  right: -3px;
  border-bottom-left-radius: 1px;
  border-bottom-right-radius: 1px;
  animation: span2 2s linear infinite;
  animation-delay: 2s;
}
.img-item.unique span:nth-child(2) {
  background: linear-gradient(to bottom, rgba(0,0,0,0), #c786ff);
}
.img-item.epic span:nth-child(2) {
  background: linear-gradient(to top, rgba(0,0,0,0), #ffc532);
}
.img-item.rare span:nth-child(2) {
  background: linear-gradient(to top, rgba(0,0,0,0), #008cff);
}
.img-item.uncommon span:nth-child(2) {
  background: linear-gradient(to top, rgba(0,0,0,0), #18a821);
}
@keyframes span2 {
  0% {
      top: -100%;
  }
  100% {
      top: 100%;
  }
}

/* Bottom Edge */
.img-item span:nth-child(3) {
  height: 3px;
  width: 100%;
  bottom: -3px;
  right: -100%;
  border-top-left-radius: 1px;
  border-bottom-left-radius: 1px;
  animation: span3 2s linear infinite;
  animation-delay: 3s;
}
.img-item.unique span:nth-child(3) {
  background: linear-gradient(to left, rgba(0,0,0,0), #c786ff);
}
.img-item.epic span:nth-child(3) {
  background: linear-gradient(to top, rgba(0,0,0,0), #ffc532);
}
.img-item.rare span:nth-child(3) {
  background: linear-gradient(to top, rgba(0,0,0,0), #008cff);
}
.img-item.uncommon span:nth-child(3) {
  background: linear-gradient(to top, rgba(0,0,0,0), #18a821);
}
@keyframes span3 {
  0% {
      right: -100%;
  }
  100% {
      right: 100%;
  }
}

/* Left Edge */
.img-item span:nth-child(4) {
  height: 100%;
  width: 3px;
  bottom: -100%;
  left: -3px;
  border-top-right-radius: 1px;
  border-top-left-radius: 1px;
  animation: span4 2s linear infinite;
  animation-delay: 4s;
}
.img-item.unique span:nth-child(4) {
  background: linear-gradient(to top, rgba(0,0,0,0), #c786ff);
}
.img-item.epic span:nth-child(4) {
  background: linear-gradient(to top, rgba(0,0,0,0), #ffc532);
}
.img-item.rare span:nth-child(4) {
  background: linear-gradient(to top, rgba(0,0,0,0), #008cff);
}
.img-item.uncommon span:nth-child(4) {
  background: linear-gradient(to top, rgba(0,0,0,0), #18a821);
}
@keyframes span4 {
  0% {
      bottom: -100%;
  }
  100% {
      bottom: 100%;
  }
}
.detail-item {
  width: 172px;
}
@media (max-width: 576.98px) {

  .img-item {
    width: 95px;
    height: 95px;
  }
  .img-item img{
    width: 65px;
    height: 65px;
  }
  .name-item{
    font-size: 12px;
  }


}