/* ranking.css — RANKING 페이지 전용 (공통부는 common.css) */

.ranking-card {
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(150, 94, 171, 0.11);
  padding: 22px;
  overflow: hidden;
}

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tab-btn {
  border: 1px solid rgba(226, 194, 223, 0.66); border-radius: var(--radius-sm); padding: 12px 18px;
  font-family: inherit; font-weight: 950; cursor: pointer; color: #7b628a;
  background: rgba(255, 255, 255, .9); box-shadow: 0 8px 18px rgba(150, 94, 171, 0.08);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.tab-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(150, 94, 171, 0.13); }
.tab-btn.active { background: linear-gradient(135deg, #ff7eb7, #a965e8); color: white; border-color: transparent; box-shadow: 0 10px 24px rgba(176, 97, 209, .24); }

.period-box { display: flex; align-items: center; gap: 8px; }
.month-select { border: 1px solid rgba(226, 194, 223, 0.66); border-radius: var(--radius-sm); background: rgba(255,255,255,.92); padding: 12px 14px; color: #765a88; font-family: inherit; font-weight: 850; outline: none; cursor: pointer; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-box { border-radius: var(--radius-md); padding: 16px; background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,241,249,.82)); border: 1px solid rgba(236, 206, 232, 0.78); }
.summary-label { font-size: 12px; color: #9c82ae; font-weight: 950; margin-bottom: 5px; }
.summary-value { font-size: clamp(24px, 3vw, 31px); font-weight: 950; color: #b05cc9; letter-spacing: -0.04em; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; margin-bottom: 18px; }
.winner { border-radius: var(--radius-md); padding: 18px 14px; text-align: center; background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,241,251,.9)); border: 1px solid rgba(236, 206, 232, 0.72); box-shadow: 0 12px 30px rgba(177, 116, 195, .12); }
.winner.rank-1 { min-height: 218px; background: linear-gradient(180deg, #fff6cf 0%, #fff 48%, #ffe8f7 100%); }
.winner.rank-2 { min-height: 188px; }
.winner.rank-3 { min-height: 170px; }
.crown { font-size: 28px; margin-bottom: 8px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 4px solid white; background: #f3e7fb; box-shadow: 0 10px 24px rgba(144,88,175,.2); }
.winner-name { margin-top: 10px; font-size: 16px; font-weight: 950; color: #4b3659; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.winner-tier { margin-top: 9px; }
.winner-sub { margin-top: 7px; min-height: 16px; font-size: 12px; color: #9d7daf; font-weight: 800; }

.tier-badge, .phrase {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%;
  border-radius: var(--radius-sm); background: rgba(255,255,255,.78); color: #735b84;
  font-size: 13px; font-weight: 950; box-shadow: inset 0 0 0 1px rgba(220,183,238,.45); white-space: nowrap;
}
.tier-badge { padding: 8px 12px; }
.phrase { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; padding: 7px 10px; }
.favorite-bj { display: inline-flex; align-items: center; justify-content: center; max-width: 180px; border-radius: var(--radius-sm); background: rgba(255,255,255,.72); color: #7a5b8c; font-size: 13px; font-weight: 950; box-shadow: inset 0 0 0 1px rgba(220,183,238,.42); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 7px 10px; }

.table-wrap { overflow: hidden; border-radius: var(--radius-md); background: rgba(255,255,255,.7); border: 1px solid rgba(236, 206, 232, 0.72); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th:nth-child(1), td:nth-child(1) { width: 80px; }
th:nth-child(2), td:nth-child(2) { width: 38%; }
th:nth-child(3), td:nth-child(3) { width: 26%; }
th:nth-child(4), td:nth-child(4) { width: 30%; }
thead { background: linear-gradient(135deg, rgba(255,127,200,.18), rgba(167,127,255,.16)); color: #7d5a92; }
th, td { padding: 14px 12px; text-align: center; border-bottom: 1px solid rgba(221,199,232,.45); }
tbody tr:hover { background: rgba(255,245,251,.72); }
tbody tr:last-child td { border-bottom: 0; }
.rank-num { font-weight: 950; color: #a27ab5; width: 70px; }
.user-cell { display: flex; align-items: center; justify-content: flex-start; width: 230px; margin: 0 auto; gap: 10px; text-align: left; min-width: 180px; }
.mini-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 3px solid white; background: #f3e7fb; flex: 0 0 auto; }
.nickname { font-weight: 950; color: #4b3659; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 165px; }
.sub-score { font-size: 13px; color: #9c80ad; font-weight: 900; white-space: nowrap; }
.round-select { max-width: 220px; }
.loading { text-align: center; padding: 40px; font-weight: 900; color: #9d7daf; }

/* 준비 중(빈 데이터) 상태 — 채팅 랭킹 등 데이터가 없을 때 표시 */
.prep-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; min-height: 240px; padding: 60px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,241,251,.92));
  border: 1px dashed rgba(220,183,238,.85);
}
.prep-icon { font-size: 48px; line-height: 1; animation: prepFloat 2.6s ease-in-out infinite; }
.prep-title {
  font-size: clamp(22px, 3.4vw, 28px); font-weight: 950; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ff7eb7, #a965e8);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.prep-desc { font-size: 14px; font-weight: 850; color: #9d7daf; line-height: 1.65; }
@keyframes prepFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .prep-icon { animation: none; } }

@media (max-width: 900px) { .podium { gap: 10px; } }

@media (max-width: 700px) {
  .ranking-card { border-radius: var(--radius-md); padding: 14px 10px; }
  .topbar { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
  .tabs { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .tab-btn { width: 100%; min-height: 42px; padding: 8px 4px; border-radius: var(--radius-sm); font-size: 12px; line-height: 1.15; white-space: nowrap; }
  .period-box { width: auto; justify-content: flex-end; margin-left: auto; }
  .month-select { width: auto; min-width: 116px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12px; }
  .round-select { min-width: 96px; max-width: 150px; }
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 9px; }
  .summary-box { min-height: 44px; border-radius: 7px; padding: 5px 4px; display: flex; flex-direction: column; justify-content: center; }
  .summary-label { font-size: 6px; line-height: 1; letter-spacing: -0.45px; margin-bottom: 3px; white-space: nowrap; }
  .summary-value { font-size: clamp(12px, 4vw, 15px); line-height: 1; letter-spacing: -0.8px; white-space: nowrap; }
  .podium { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: stretch; margin-bottom: 12px; }
  .winner, .winner.rank-1, .winner.rank-2, .winner.rank-3 { min-height: 132px; border-radius: var(--radius-sm); padding: 9px 4px; }
  .crown { font-size: 17px; margin-bottom: 5px; }
  .avatar { width: 46px; height: 46px; border-width: 3px; }
  .winner-name { margin-top: 7px; font-size: 11px; line-height: 1.15; }
  .winner-tier { margin-top: 6px; }
  .winner-sub { margin-top: 4px; font-size: 9px; }
  .winner .tier-badge { font-size: 9px; padding: 5px 6px; gap: 3px; }
  .table-wrap { border-radius: var(--radius-sm); }
  th, td { padding: 9px 3px; font-size: 11px; line-height: 1.2; }
  th:nth-child(1), td:nth-child(1) { width: 12%; }
  th:nth-child(2), td:nth-child(2) { width: 38%; }
  th:nth-child(3), td:nth-child(3) { width: 25%; }
  th:nth-child(4), td:nth-child(4) { width: 25%; }
  .rank-num { width: auto; font-size: 14px; }
  .user-cell { width: 100%; min-width: 0; gap: 5px; }
  .mini-avatar { width: 28px; height: 28px; border-width: 2px; }
  .nickname { max-width: 68px; font-size: 12px; line-height: 1.15; }
  td .tier-badge { max-width: 92px; padding: 5px 6px; gap: 3px; font-size: 10px; line-height: 1; }
  .sub-score { font-size: 10px; line-height: 1.15; }
  .phrase { max-width: 92px; padding: 5px 7px; font-size: 10px; }
  .favorite-bj { max-width: 78px; padding: 5px 7px; font-size: 10px; }
  .prep-state { min-height: 180px; padding: 40px 16px; gap: 9px; }
  .prep-icon { font-size: 38px; }
  .prep-desc { font-size: 12.5px; }
}

@media (max-width: 380px) {
  .tab-btn { font-size: 11px; }
  .summary-label { font-size: 6.5px; }
  .summary-value { font-size: 15px; }
  .winner, .winner.rank-1, .winner.rank-2, .winner.rank-3 { min-height: 124px; }
  .avatar { width: 42px; height: 42px; }
  .winner-name { font-size: 10px; }
  .nickname { max-width: 58px; font-size: 11px; }
  td .tier-badge { max-width: 82px; font-size: 9px; padding: 5px 5px; }
  .sub-score { font-size: 9px; }
}

/* 후원액 열 숨김 — 순위·닉네임·등급만 표시 */
#extraHeader,
#rankingBody td:nth-child(4) { display: none; }
.winner-sub { display: none; }
th:nth-child(3), td:nth-child(3) { width: auto; }
@media (max-width: 700px) { th:nth-child(3), td:nth-child(3) { width: auto; } }
