/* =================================================================== */
/*             IG 粉絲排行榜 - 最終整合 CSS (含手機版修正)              */
/* =================================================================== */

/* --- 主要容器 --- */
.ig-leaderboard {
  max-width: 600px;
  margin: 0 auto 40px auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: system-ui, -apple-system, sans-serif;
}

/* --- 單張卡片 --- */
.ig-rank-card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  padding: 12px 20px;
  color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.ig-rank-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* --- 左側：排名數字與皇冠 --- */
.rank-number-wrapper {
  width: 40px;
  flex-shrink: 0;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
}
.rank-number {
  font-size: 20px;
  font-weight: 600;
  color: #e1306c;
  line-height: 1;
}
.rank-crown {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  color: #ffc107;
}
.ig-rank-card.rank-top-1 .rank-number,
.ig-rank-card.rank-top-2 .rank-number,
.ig-rank-card.rank-top-3 .rank-number {
  font-size: 26px;
}

/* --- 左側：頭像 --- */
.rank-thumb-link {
  flex-shrink: 0;
}
.rank-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #f0f0f0;
  display: block;
}
.rank-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- 中間：資訊區 (姓名 & 節目) --- */
.rank-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 16px;
  align-items: flex-start;
  min-width: 0; /* <<-- 解決重疊的關鍵！允許此區塊被壓縮 */
}
.rank-name,
.rank-show {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-name {
  font-size: 28px;
  font-weight: 300;
  text-decoration: none;
  color: #333;
  transition: color 0.2s;
}
.rank-name:hover { color: #e1306c; }
.rank-show {
  font-size: 13px;
  color: #777;
  text-decoration: none;
  transition: color 0.2s;
}
.rank-show:hover { color: #e1306c; }
.rank-show-placeholder {
  font-size: 13px;
  height: 1em;
}

/* --- 右側：粉絲數 --- */
.rank-fans {
  color: #e1306c;
  margin-left: auto;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 0.25em;
}
.fans-number {
  font-size: 22px;
  font-weight: 300;
  line-height: 1; 
}
.fans-unit {
  font-size: 13px;
  font-weight: 100;
}


/* =================================================================== */
/*             !!! 手機版響應式修正 !!!                              */
/* =================================================================== */
@media (max-width: 768px) {
  /* 縮小卡片內邊距，爭取空間 */
  .ig-rank-card {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* 縮小頭像 */
  .rank-thumb {
    width: 48px;
    height: 48px;
  }
  
  /* 縮小各種間距 */
  .rank-number-wrapper { margin-right: 12px; }
  .rank-info { margin: 0 10px; }
  
  /* 縮小各種字體 */
  .rank-name {
    font-size: 18px; /* 大幅縮小姓名，避免重疊 */
  }
  .fans-number {
    font-size: 16px; /* 縮小粉絲數 */
  }
  .fans-unit {
    font-size: 12px;
  }
  .rank-number,
  .ig-rank-card.rank-top-1 .rank-number,
  .ig-rank-card.rank-top-2 .rank-number,
  .ig-rank-card.rank-top-3 .rank-number {
    font-size: 18px; /* 統一排名數字大小 */
  }
}