/* 每日挑战 + 个人主页 + 排行榜 样式 */

/* ========== 挑战页面布局 ========== */
.challenge-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 56px;
  min-height: 100%;
}
.challenge-page h1 {
  font-size: var(--text-hero);
  font-weight: 700;
  margin: 0 0 8px;
}
.challenge-page .page-lead {
  color: var(--color-text-secondary);
  margin: 0 0 24px;
  font-size: var(--text-md);
}

/* ========== 难度筛选标签 ========== */
.difficulty-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.difficulty-tab {
  padding: 7px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  color: var(--color-text-secondary);
}
.difficulty-tab:hover {
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}
.difficulty-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ========== 挑战列表 ========== */
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.challenge-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.challenge-card:hover {
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.challenge-card.passed {
  border-left: 3px solid var(--color-success);
  opacity: 0.75;
}
.challenge-card .card-stars {
  flex-shrink: 0;
  font-size: 14px;
  color: #f59e0b;
}
.challenge-card .card-title {
  flex: 1;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
}
.challenge-card .card-type {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.challenge-card .card-points {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: 600;
  flex-shrink: 0;
}
.challenge-card .card-status {
  flex-shrink: 0;
  font-size: 16px;
}

/* ========== 筛选栏 ========== */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar .difficulty-tabs {
  margin-bottom: 0;
}
.status-filter {
  display: flex;
  gap: 8px;
  align-items: center;
}
.status-filter select {
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.status-filter select:hover {
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}

/* ========== 分页 ========== */
.list-pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  padding: 12px 0;
}
.list-pagination .page-btn {
  padding: 7px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}
.list-pagination .page-btn:hover:not(:disabled) {
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}
.list-pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.list-pagination .page-info {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ========== 今日推荐 ========== */
.today-section {
  margin-bottom: 20px;
}
.today-header {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 10px;
}
.challenge-card.today-card {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(245,158,11,0.04), rgba(245,158,11,0.01));
}
.challenge-card.today-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 12px rgba(245,158,11,0.15);
}
.card-new-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 16px;
}

/* ========== 挑战详情区 ========== */
.challenge-detail {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 20px;
}
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.detail-header .detail-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 0;
  flex: 1;
}
.detail-header .detail-stars {
  color: #f59e0b;
  font-size: 16px;
}
.detail-header .detail-type-badge {
  font-size: var(--text-xs);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 500;
}
.detail-header .detail-points {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: 600;
}
.detail-desc {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: 20px;
  white-space: pre-wrap;
}

/* 代码编辑区 */
.code-editor-wrap {
  position: relative;
  margin-bottom: 16px;
}
.code-editor {
  width: 100%;
  min-height: 160px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  resize: vertical;
  tab-size: 4;
  white-space: pre;
  overflow-x: auto;
}
.code-editor:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.code-editor.readonly {
  background: #0f172a;
  cursor: default;
}

/* CodeMirror 适配 */
.code-editor-wrap .CodeMirror {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  min-height: 160px;
  height: auto;
}
.code-editor-wrap .CodeMirror-focused {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.code-editor-wrap .CodeMirror-readonly {
  background: #0f172a;
}

/* 猜输出输入框 */
.guess-area {
  margin-bottom: 16px;
}
.guess-area label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-text);
}
.guess-hint {
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.guess-input {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  resize: vertical;
}
.guess-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.guess-input.locked {
  background: var(--color-surface);
  color: var(--color-text-muted);
}

/* 操作栏 */
.action-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.btn-submit {
  padding: 10px 28px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-base);
}
.btn-submit:hover { background: var(--color-primary-hover); }
.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-hint {
  padding: 10px 18px;
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}
.btn-hint:hover {
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}
.btn-back {
  padding: 10px 18px;
  background: none;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.btn-back:hover { border-color: var(--color-border-strong); }
.attempts-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-left: auto;
}

/* 结果区域 */
.result-area {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.6;
  position: relative;
}
.result-area.pass {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
  color: #065f46;
}
.result-area.fail {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
  color: #991b1b;
}
.result-output {
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.04);
  border-radius: var(--radius-sm);
}
.solution-reveal {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.solution-reveal h4 {
  margin: 0 0 8px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.solution-reveal pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--color-text);
}

/* 提示卡片 */
.hints-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.hint-card {
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: #92400e;
  animation: hintSlide 0.3s ease;
}
@keyframes hintSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 动画 ========== */
@keyframes challengePass {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.01); }
  100% { transform: scale(1); box-shadow: 0 0 0 3px var(--color-success); }
}
@keyframes challengeShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
@keyframes pointsFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-50px) scale(1.2); }
}
.anim-pass { animation: challengePass 0.5s ease forwards; }
.anim-shake { animation: challengeShake 0.4s ease; }
.points-float {
  position: absolute;
  top: -10px;
  right: 20px;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-accent);
  pointer-events: none;
  animation: pointsFloat 1.2s ease forwards;
}

/* ========== 底栏状态 ========== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}
.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
}
.status-item .status-value {
  font-weight: 600;
  color: var(--color-text);
}
.status-item .status-value.accent {
  color: var(--color-accent);
}

/* ========== 规则页 ========== */
.rules-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 36px 28px 56px;
}
.rules-page h1 {
  text-align: center;
  font-size: var(--text-hero);
  font-weight: 700;
  margin: 0 0 8px;
}
.rules-page .rules-lead {
  text-align: center;
  color: var(--color-text-secondary);
  margin: 0 0 32px;
  font-size: var(--text-md);
}
.rules-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}
.rules-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.rules-step .step-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
}
.rules-step .step-content h3 {
  margin: 0 0 4px;
  font-size: var(--text-md);
  font-weight: 600;
}
.rules-step .step-content p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}
.rules-section {
  margin-bottom: 28px;
}
.rules-section h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 12px;
}
.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.rules-table th, .rules-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.rules-table th {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
}
.rules-cta {
  text-align: center;
  margin-top: 32px;
}
.rules-cta .btn-start {
  display: inline-block;
  padding: 14px 48px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: all var(--transition-base);
}
.rules-cta .btn-start:hover { background: var(--color-primary-hover); }

/* ========== 个人主页 ========== */
.profile-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, #0f766e 100%);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-info .profile-name {
  font-size: var(--text-xl);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-info .profile-name .display-badge {
  font-size: 20px;
}
.profile-info .profile-level {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}
.profile-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.profile-stat {
  text-align: center;
}
.profile-stat .stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
}
.profile-stat .stat-value.accent { color: var(--color-accent); }
.profile-stat .stat-value.primary { color: var(--color-primary); }
.profile-stat .stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ========== 徽章墙 ========== */
.badge-section {
  margin-bottom: 28px;
}
.badge-section h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 14px;
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.badge-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.badge-item.locked {
  opacity: 0.45;
  filter: grayscale(1);
  cursor: default;
}
.badge-item.locked:hover { transform: none; box-shadow: none; }
.badge-item.rarity-2 { border-color: var(--color-primary); }
.badge-item.rarity-3 { border-color: var(--color-accent); }
.badge-item.rarity-4 { border-image: linear-gradient(135deg, #f59e0b, #ef4444, #8b5cf6) 1; }
.badge-item .badge-icon { font-size: 32px; }
.badge-item .badge-name {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
}
.badge-item.locked .badge-name { color: var(--color-text-muted); }
.badge-item .badge-lock { font-size: 14px; color: var(--color-text-muted); }

/* ========== 徽章解锁弹窗 ========== */
.badge-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.badge-modal {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  text-align: center;
  min-width: 300px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: badgeBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badgeBounce {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.badge-modal .modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text);
}
.badge-modal .modal-icon {
  font-size: 56px;
  margin-bottom: 12px;
  display: block;
}
.badge-modal .modal-badge-name {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 6px;
}
.badge-modal .modal-badge-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}
.badge-modal .modal-rarity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: 20px;
}
.badge-modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.badge-modal .modal-actions button {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  transition: all var(--transition-fast);
}
.badge-modal .modal-actions button.primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.badge-modal .modal-actions button.primary:hover { background: var(--color-primary-hover); }

/* ========== 排行榜页面 ========== */
.rank-page {
  padding: 0 6% 60px;
  width: 100%;
  box-sizing: border-box;
}

/* 页面头部 */
.rank-header {
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 50%, #a78bfa 100%);
  border-radius: 16px;
  padding: 28px 32px 20px;
  margin-bottom: 20px;
  margin-top: 28px;
  color: #fff;
}
.rank-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.rank-header-icon {
  font-size: 40px;
  line-height: 1;
}
.rank-header-text h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.rank-header-text p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.85;
}
.rank-stats {
  display: flex;
  gap: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  overflow: hidden;
}
.rank-stat-item {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-right: 1px solid rgba(255,255,255,0.12);
}
.rank-stat-item:last-child { border-right: none; }
.rank-stat-item .stat-val {
  display: block;
  font-size: 20px;
  font-weight: 800;
}
.rank-stat-item .stat-label {
  display: block;
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}

/* 我的排名卡片 */
.rank-my-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-primary);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}
.my-card-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #818cf8);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.my-card-info { flex: 1; min-width: 0; }
.my-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
}
.my-card-detail {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.my-card-rank {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-primary);
  flex-shrink: 0;
}
.my-card-pts {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-accent);
  flex-shrink: 0;
}
.my-card-pts small {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* 领奖台 */
.rank-podium {
  margin-bottom: 20px;
}
.podium-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 18px 16px;
  border-radius: 16px;
  width: 180px;
  text-align: center;
  position: relative;
  transition: transform 0.2s ease;
}
.podium-item:hover {
  transform: translateY(-4px);
}
.podium-gold {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fbbf24 100%);
  box-shadow: 0 8px 32px rgba(251, 191, 36, 0.3);
  padding-top: 28px;
  padding-bottom: 22px;
  order: 2;
}
.podium-silver {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #cbd5e1 100%);
  box-shadow: 0 6px 24px rgba(148, 163, 184, 0.25);
  order: 1;
}
.podium-bronze {
  background: linear-gradient(135deg, #fef3c7 0%, #fde9a8 50%, #f59e0b 100%);
  box-shadow: 0 6px 24px rgba(217, 119, 6, 0.2);
  order: 3;
}
.podium-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.podium-gold .podium-avatar {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  width: 60px;
  height: 60px;
  font-size: 26px;
}
.podium-silver .podium-avatar {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}
.podium-bronze .podium-avatar {
  background: linear-gradient(135deg, #f59e0b, #b45309);
}
.podium-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium-badge-icon { font-size: 14px; }
.podium-score {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 2px;
}
.podium-gold .podium-score { font-size: 24px; }
.podium-streak {
  font-size: 12px;
  color: #64748b;
}
.podium-label {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.08);
  color: #475569;
}

/* 完整排名表 */
.rank-table-section {
  margin-bottom: 24px;
}
.rank-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.rank-table-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--color-text);
}
.rank-user-count {
  font-size: 13px;
  color: var(--color-text-muted);
}
.rank-list {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
}
.rank-row:hover {
  background: rgba(99, 102, 241, 0.04);
}
.rank-row:last-of-type { border-bottom: none; }
.rank-row.is-me {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03));
  border-left: 3px solid var(--color-primary);
}
.rank-row .rank-pos {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text-muted);
  flex-shrink: 0;
  border-radius: 8px;
}
.rank-row .rank-pos.gold {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
}
.rank-row .rank-pos.silver {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #475569;
}
.rank-row .rank-pos.bronze {
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  color: #9a3412;
}
.rank-row .rank-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #818cf8);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rank-row .rank-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rank-row .rank-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 14px;
}
.rank-row .rank-badge { font-size: 16px; }
.rank-row .rank-me-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.rank-row .rank-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}
.rank-row .rank-points {
  font-weight: 700;
  font-size: 18px;
  color: var(--color-accent);
  flex-shrink: 0;
  text-align: right;
}
.rank-row .rank-points small {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
}
.rank-separator {
  padding: 8px 20px;
  text-align: center;
  font-size: 18px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  letter-spacing: 6px;
}
.rank-footer {
  padding: 14px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-surface);
}

/* 空状态 */
.rank-empty {
  text-align: center;
  padding: 48px 24px;
}
.rank-empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
}
.rank-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}
.rank-empty-desc {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}
.rank-empty-btn {
  display: inline-block;
  padding: 10px 28px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.rank-empty-btn:hover {
  background: var(--color-primary-hover);
}

/* 邀请提示 */
.rank-invite {
  padding: 16px 20px;
  text-align: center;
  background: linear-gradient(135deg, #f0f9ff, #eff6ff);
  border-top: 1px solid var(--color-border);
}
.rank-invite-text {
  font-size: 13px;
  color: #3b82f6;
  font-weight: 500;
}

/* ========== 排行榜链接 ========== */
.btn-rank-link {
  display: inline-block;
  padding: 10px 24px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.btn-rank-link:hover {
  background: var(--color-primary-hover);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .challenge-page, .profile-page, .rules-page {
    padding: 20px 16px 40px;
  }
  .rank-page {
    padding: 20px 16px 40px;
    max-width: 100%;
  }
  .podium-row {
    gap: 6px;
  }
  .podium-item {
    width: 110px;
    padding: 14px 8px 12px;
  }
  .podium-avatar {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .podium-gold .podium-avatar {
    width: 48px;
    height: 48px;
  }
  .podium-score { font-size: 16px; }
  .podium-gold .podium-score { font-size: 20px; }
  .rank-row {
    padding: 10px 14px;
    gap: 8px;
  }
  .rank-row .rank-level { display: none; }
  .profile-header {
    flex-direction: column;
    text-align: center;
  }
  .profile-stats {
    justify-content: center;
  }
  .badge-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
}
