.trending {
  max-width: 90%;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.ranking-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 24px 20px;
  color: rgb(175, 116, 116);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.pink {
  background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
  color: #fff;
}

.blue {
  background: linear-gradient(135deg, #6190e8, #a7bfe8);
  color: #fff;
}

.ranking-header h1 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.ranking-header p {
  opacity: 0.9;
}

.ranking-list {
  overflow-y: auto;
  flex: 1;
  max-height: calc(100vh - 200px);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  align-content: start;
}

.ranking-item {
  background-color: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.ranking-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  border-color: rgba(116, 185, 255, 0.3);
}

.item-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #74b9ff, #0984e3);
  color: white;
  position: relative;
  overflow: hidden;
}

.item-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ranking-item:hover .item-header::before {
  opacity: 1;
}

.rank {
  font-size: 1.8rem;
  font-weight: bold;
  margin-right: 16px;
  min-width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.ranking-item:hover .rank {
  transform: scale(1.1) rotate(5deg);
  background: rgba(255, 255, 255, 0.3);
}

.rank-1 {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.rank-2 {
  color: #c0c0c0;
  border-color: rgba(192, 192, 192, 0.5);
  box-shadow: 0 0 20px rgba(192, 192, 192, 0.3);
}

.rank-3 {
  color: #cd7f32;
  border-color: rgba(205, 127, 50, 0.5);
  box-shadow: 0 0 20px rgba(205, 127, 50, 0.3);
}

.item-info {
  flex: 1;
}

.item-title {
  font-size: 1.1rem;
  margin-bottom: 6px;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.item-meta {
  font-size: 0.8rem;
  opacity: 0.9;
}

.item-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.heat-bar {
  height: 10px;
  background-color: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.heat-progress {
  height: 100%;
  background: linear-gradient(90deg, #ff7675, #f54ea2, #ff6b9d);
  border-radius: 10px;
  position: relative;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(255, 118, 117, 0.4);
}

.heat-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.heat-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

.heat-value-span {
  color: #ff6b6b !important;
  font-weight: 600;
  font-size: 1rem;
}

.item-description {
  color: #666;
  line-height: 1.6;
  font-size: 0.9rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
  border-radius: 6px;
  font-size: 0.75rem;
  margin-right: 8px;
  margin-bottom: 6px;
  color: #555;
  font-weight: 500;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tag:hover {
  background: linear-gradient(135deg, #74b9ff, #0984e3);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(116, 185, 255, 0.3);
}

.tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

@media (max-width: 1200px) {
  .ranking-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .trending {
    max-width: 95%;
    padding: 10px;
  }
  
  .ranking-list {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    max-height: calc(100vh - 180px);
    padding: 8px;
  }

  .ranking-header h1 {
    font-size: 1.5rem;
  }
  
  .page {
    height: calc(100vh - 90px);
    min-height: calc(100vh - 90px);
  }

  .item-content {
    padding: 16px;
  }

  .item-header {
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .ranking-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .item-header {
    flex-direction: row;
    text-align: left;
    padding: 12px 14px;
  }

  .rank {
    margin-right: 12px;
    margin-bottom: 0;
    min-width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }

  .item-content {
    padding: 12px 14px;
  }

  .item-title {
    font-size: 0.95rem;
  }
}

/* ============================================
   移动端增强
   ============================================ */

/* 手机设备 (≤480px) */
@media screen and (max-width: 480px) {
  .trending {
    max-width: 100%;
    padding: 8px;
    height: 100%;
  }

  .ranking-header {
    padding: 16px 14px;
    margin-bottom: 16px;
    border-radius: 12px;
  }

  .ranking-header h1 {
    font-size: 1.3rem;
    margin-bottom: 6px;
  }

  .ranking-header p {
    font-size: 0.75rem;
  }

  .ranking-list {
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: calc(100vh - 180px);
    padding: 4px;
  }

  .ranking-item {
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .ranking-item:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }

  .rank {
    min-width: 40px;
    height: 40px;
    font-size: 1.4rem;
    border-radius: 10px;
  }

  .item-info {
    flex: 1;
  }

  .item-meta {
    font-size: 0.72rem;
  }

  .item-content {
    padding: 12px 14px;
    gap: 8px;
  }

  .heat-bar {
    height: 6px;
    border-radius: 6px;
  }

  .heat-value {
    font-size: 0.78rem;
  }

  .heat-value-span {
    font-size: 0.9rem;
  }

  .item-description {
    font-size: 0.82rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.5;
  }

  .tag {
    padding: 4px 8px;
    font-size: 0.68rem;
    margin-right: 4px;
    margin-bottom: 4px;
    border-radius: 4px;
  }

  .tag:hover {
    transform: none;
  }
}

/* 小屏手机 (≤374px) */
@media screen and (max-width: 374px) {
  .ranking-header h1 {
    font-size: 1.1rem;
  }

  .ranking-header {
    padding: 12px 10px;
  }

  .rank {
    min-width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .item-title {
    font-size: 0.88rem;
  }
}

/* 平板横屏 (481px - 1024px, landscape) */
@media screen and (min-width: 481px) and (max-width: 1024px) and (orientation: landscape) {
  .ranking-list {
    grid-template-columns: repeat(2, 1fr);
    max-height: calc(100vh - 160px);
  }
}

/* 触摸优化 */
@media screen and (max-width: 768px) {
  .ranking-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    height: 170px;
  }

  .ranking-item:active {
    opacity: 0.9;
    transform: scale(0.99);
  }

  .tag {
    -webkit-tap-highlight-color: transparent;
  }
}

/* iOS 安全区域 */
@supports (padding-top: env(safe-area-inset-top)) {
  @media screen and (max-width: 480px) {
    .trending {
      padding-top: calc(8px + env(safe-area-inset-top));
      padding-left: calc(8px + env(safe-area-inset-left));
      padding-right: calc(8px + env(safe-area-inset-right));
    }
  }
}
