/* ==============================
   Badge Grid Layout
   ============================== */

.badge-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* 常に4列 */
    gap: 16px;
    margin-top: 16px;
}

/* ==============================
   Badge Item
   ============================== */

.badge-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.badge-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* 未読バッジ */
.badge-unseen {
    background: #ffffff;
    border-color: #f1d882;
}

/* ==============================
   Badge Icon
   ============================== */

.badge-icon {
    width: 100%;
    max-width: 200px;   /* ← 上限 */
    object-fit: contain;
    margin: 0 auto 6px;
    display: block;
}

/* 画像ロード失敗時の保険 */
.badge-icon[src=""],
.badge-icon:not([src]) {
    content: url("/ext/img/badges/common/no_badge.png");
}

/* ==============================
   Badge Text Info
   ============================== */

.badge-info h4 {
    font-size: 13px;
    font-weight: bold;
    margin: 4px 0 2px;
    line-height: 1.3;
}

.badge-info p {
    font-size: 11px;
    color: #555;
    margin: 0 0 4px;
    line-height: 1.3;
}

.badge-info small {
    font-size: 10px;
    color: #999;
}

/* ==============================
   NEW Label
   ============================== */

.badge-new {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
}

/* =========================
   Badge Modal
========================= */

#badgeModal {
  transform: translateY(60px);
}

/* closeボタン */
#badgeModalClose {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 34px;
  cursor: pointer;
}

/* 画像中央 */
.badge-modal-image-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.badge-modal-image {
  width: 250px;
  height: 250px;
  object-fit: contain;
}

/* テキスト */
.badge-modal-title {
  text-align: center;
  margin-bottom: 8px;
}

.badge-modal-desc,
.badge-modal-count {
  text-align: center;
  font-size: 15px;
}

/* 保有者 */
.badge-modal-owners {
  margin-top: 16px;
  font-size: 15px;
}
/* ==============================
   Mobile Optimization (4列維持)
   ============================== */

@media screen and (max-width: 768px) {

    .badge-list {
        gap: 10px;
    }

    .badge-item {
        padding: 8px 4px;
    }

    .badge-icon {
        width: 100%;
        max-width: 200px;   /* ← 上限 */
        margin-bottom: 4px;
    }

    /* スマホでは説明文を省略（一覧性重視） */
    .badge-info p,
    .badge-info small {
        display: none;
    }

    .badge-info h4 {
        font-size: 11px;
        margin: 2px 0 0;
    }

    .badge-modal-body {
        flex-direction: column;
    }

    .badge-owner-list {
        grid-template-columns: repeat(4, 1fr);
    }

    .badge-modal-left img {
        width: 120px;
    }
}
