/* ========== 排名页面：卡片网格 ========== */
.rank-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 32px 40px 40px;
  width: 100%;
  box-sizing: border-box;
}

.rank-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.rank-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.rank-card-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
}

.rank-card-icon {
  font-size: 48px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.2);
  margin-bottom: 12px;
  line-height: 1;
}

.rank-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.rank-card-count {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* 悬浮显示前三名 */
.rank-card-top3 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  padding: 12px 16px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.rank-card:hover .rank-card-top3 {
  transform: translateY(0);
}

.rank-card-top3-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.rank-card-top3-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-card-top3-item:nth-child(1) .rank-card-top3-rank {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #1a1a2e;
}

.rank-card-top3-item:nth-child(2) .rank-card-top3-rank {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #1a1a2e;
}

.rank-card-top3-item:nth-child(3) .rank-card-top3-rank {
  background: linear-gradient(135deg, #cd7f32, #b8690e);
  color: #fff;
}

.rank-card-top3-name {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== 排名列表视图 ========== */
.rank-list-view {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 40px 40px;
}

.rank-list-table-wrap {
  overflow-x: auto;
}

.rank-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rank-list-table th,
.rank-list-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.rank-list-table th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rank-list-row {
  cursor: pointer;
  transition: background 0.15s;
}

.rank-list-row:hover td {
  background: rgba(255, 255, 255, 0.06);
}

/* 排名序号 */
.rank-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.rank-cell.top-1 {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #1a1a2e;
}

.rank-cell.top-2 {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #1a1a2e;
}

.rank-cell.top-3 {
  background: linear-gradient(135deg, #cd7f32, #b8690e);
  color: #fff;
}

.rank-cell-id {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.rank-cell-name {
  font-weight: 600;
}

.rank-cell-points {
  font-weight: 600;
  color: #64b5f6;
}

/* 升降状态 */
.rank-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

.rank-change.up {
  color: #4caf50;
}

.rank-change.down {
  color: #f44336;
}

.rank-change.same {
  color: rgba(255, 255, 255, 0.4);
}

.rank-change svg {
  flex-shrink: 0;
}

/* ========== 运动员详情弹窗 ========== */
.rank-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rankFadeIn 0.2s ease;
}

.rank-detail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}

.rank-detail-content {
  position: relative;
  background: rgba(10, 10, 30, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 32px;
  width: 600px;
  max-width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  animation: rankSlideUp 0.25s ease;
}

.rank-detail-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: color 0.15s;
}

.rank-detail-close:hover {
  color: #fff;
}

.rank-detail-title {
  font-size: 20px;
  color: #fff;
  font-weight: 600;
  margin-bottom: 24px;
  padding-right: 32px;
}

.rank-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rank-detail-field {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 3px solid rgba(0, 123, 255, 0.5);
}

.rank-detail-field-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rank-detail-field-value {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

/* ========== 动画 ========== */
@keyframes rankFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rankSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
  .rank-card {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 900px) {
  .rank-card-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 20px 20px;
  }

  .rank-card {
    aspect-ratio: 4 / 3;
  }

  .rank-list-view {
    padding: 0 20px 20px;
  }

  .rank-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .rank-card-grid {
    grid-template-columns: 1fr;
  }

  .rank-list-table th,
  .rank-list-table td {
    padding: 10px 8px;
    font-size: 13px;
  }
}
