.back-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 150ms;
}

.back-link:hover {
  opacity: 0.7;
}

/* ===== NAV ===== */
.ranking-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ranking-nav::-webkit-scrollbar {
  display: none;
}

.rank-nav-btn {
  height: 32px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-sub);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
  flex-shrink: 0;
}

.rank-nav-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.rank-nav-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f0f0f;
  font-weight: 600;
}

/* ===== MAIN ===== */
.ranking-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ===== USAGE GUIDE ===== */
.usage-guide {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 0;
}

.usage-guide-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  font-feature-settings: "palt";
  margin-bottom: 16px;
  color: var(--text);
}

.usage-guide-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.usage-rule {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.usage-rule-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.usage-rule-body strong {
  font-size: 14px;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

.usage-rule-body p {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

.usage-example {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
}

.usage-example-label {
  font-size: 12px;
  color: var(--text-sub);
  display: block;
  margin-bottom: 12px;
}

.usage-example-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.usage-ex-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.usage-ex-rank {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 4px;
}

.usage-ex-rank.gold {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.usage-ex-rank.silver {
  background: rgba(200, 200, 200, 0.1);
  color: #c8c8c8;
  border: 1px solid rgba(200, 200, 200, 0.25);
}

.usage-ex-rank.bronze {
  background: rgba(251, 146, 60, 0.1);
  color: var(--orange);
  border: 1px solid rgba(251, 146, 60, 0.25);
}

.usage-ex-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}

.usage-ex-arrow {
  color: var(--text-sub);
  font-size: 16px;
  margin-top: -16px;
}

/* ===== TAB HEADER ===== */
.rank-tab-header {
  margin-bottom: 24px;
}

/* ===== SECTION ===== */
.rank-section {
  margin-bottom: 48px;
}

.rank-section-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  font-feature-settings: "palt";
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-section-icon {
  color: var(--warning);
  font-size: 22px;
}

.rank-section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.rank-section-desc {
  color: var(--text-sub);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ===== RANK LIST ===== */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== RANK CARD ===== */
.rank-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 150ms;
}

.rank-card:hover {
  background: var(--surface-2);
}

.rank-card.medal-1 {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.04);
}

.rank-card.medal-2 {
  border-color: rgba(200, 200, 200, 0.3);
  background: rgba(200, 200, 200, 0.03);
}

.rank-card.medal-3 {
  border-color: rgba(251, 146, 60, 0.3);
  background: rgba(251, 146, 60, 0.03);
}

/* ===== RANK NUMBER ===== */
.rank-number {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.medal-1 .rank-number {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.35);
}

.medal-2 .rank-number {
  color: #c8c8c8;
  background: rgba(200, 200, 200, 0.1);
  border-color: rgba(200, 200, 200, 0.25);
}

.medal-3 .rank-number {
  color: var(--orange);
  background: rgba(251, 146, 60, 0.1);
  border-color: rgba(251, 146, 60, 0.25);
}

/* ===== PREVIEW ===== */
.rank-preview-wrap {
  width: 140px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}

.rank-preview-wrap .card-preview {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  border-bottom: none;
  padding: 8px;
}

.rank-preview-wrap .card-preview.rank-preview {
  border-bottom: none;
}

/* ===== INFO ===== */
.rank-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-info-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rank-category-tag {
  font-size: 10px;
  color: var(--accent);
  background: rgba(96, 165, 250, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
  align-self: flex-start;
  margin-bottom: 2px;
}

.rank-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  font-feature-settings: "palt";
}

.rank-usecase {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.4;
}

/* ===== SCORE BARS ===== */
.score-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-label {
  font-size: 10px;
  color: var(--text-sub);
  width: 44px;
  flex-shrink: 0;
  text-align: right;
}

.score-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
  max-width: 120px;
}

.score-fill {
  height: 100%;
  border-radius: 3px;
  opacity: 0.7;
  transition: width 300ms ease;
}

.score-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-sub);
  width: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ===== TOTAL ===== */
.rank-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  min-width: 52px;
}

.rank-total-num {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rank-total-label {
  font-size: 9px;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rank-total-sum {
  font-size: 10px;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .ranking-main {
    padding: 20px 16px 48px;
  }

  .rank-card {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .rank-number {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .rank-preview-wrap {
    width: 100px;
    height: 60px;
  }

  .rank-info {
    flex-basis: calc(100% - 160px);
  }

  .rank-total {
    flex-direction: row;
    gap: 6px;
    width: 100%;
    justify-content: flex-end;
    padding-top: 4px;
    border-top: 1px solid var(--border);
  }

  .rank-total-num {
    font-size: 18px;
  }

  .score-track {
    max-width: 80px;
  }
}

@media (max-width: 480px) {
  .rank-preview-wrap {
    width: 80px;
    height: 50px;
  }

  .rank-info {
    flex-basis: calc(100% - 130px);
  }

  .rank-name {
    font-size: 13px;
  }

  .rank-usecase {
    display: none;
  }

  .ranking-nav {
    padding: 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
