/* v24: forum rankings and compact forum feed */

.yrfc-rank-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.yrfc-rank-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid rgba(80, 50, 38, .10);
  border-radius: 12px;
  color: inherit;
  background: rgba(255, 255, 255, .45);
  cursor: pointer;
}

.yrfc-rank-row:hover {
  border-color: rgba(133, 43, 34, .28);
  background: rgba(255, 255, 255, .68);
}

.yrfc-rank-index {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff8ed;
  background: linear-gradient(135deg, #8d2a23, #1d1715);
  font-size: 12px;
  font-weight: 900;
}

.yrfc-rank-main {
  min-width: 0;
}

.yrfc-rank-main b,
.yrfc-rank-main span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.yrfc-rank-main b {
  font-size: 13px;
}

.yrfc-rank-main span {
  margin-top: 2px;
  color: rgba(62, 45, 34, .60);
  font-size: 11px;
}

.yrfc-name-link {
  border: 0;
  padding: 0;
  color: #6d1f1a;
  background: transparent;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.yrfc-name-link:hover {
  text-decoration: underline;
}

.yrfc-rank-score {
  color: #8d2a23;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.yrfc-photo-thumb {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid rgba(80, 50, 38, .14);
  background: rgba(255, 255, 255, .38);
}

.yrfc-rank-row.photo {
  grid-template-columns: 26px 38px minmax(0, 1fr) auto;
}

.forum-card.yrfc-compact-card {
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.forum-card.yrfc-compact-card:not(.is-open) {
  cursor: pointer;
}

.forum-card.yrfc-compact-card:not(.is-open):hover {
  border-color: rgba(133, 43, 34, .24);
  box-shadow: 0 14px 34px rgba(61, 48, 25, .08);
}

.forum-card.yrfc-compact-card:not(.is-open) .forum-content {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.forum-card.yrfc-compact-card:not(.is-open) .forum-images {
  display: inline-flex !important;
  align-items: center;
  width: auto !important;
  max-width: 160px;
  margin: 8px 0 4px;
  gap: 0;
}

.forum-card.yrfc-compact-card:not(.is-open) .forum-images img {
  width: 104px !important;
  height: 76px !important;
  min-width: 104px;
  max-width: 104px !important;
  max-height: 76px !important;
  object-fit: cover !important;
  border-radius: 10px;
}

.forum-card.yrfc-compact-card:not(.is-open) .forum-images img:nth-child(n+2) {
  display: none !important;
}

.forum-card.yrfc-compact-card:not(.is-open) .forum-images[data-count]::after {
  content: "共 " attr(data-count) " 图";
  align-self: flex-end;
  margin-left: 8px;
  white-space: nowrap;
  color: rgba(62, 45, 34, .58);
  font-size: 12px;
  font-weight: 800;
}

.forum-card.yrfc-compact-card:not(.is-open) .reaction-row,
.forum-card.yrfc-compact-card:not(.is-open) .comment-list,
.forum-card.yrfc-compact-card:not(.is-open) .comment-form {
  display: none !important;
}

.yrfc-detail-btn {
  width: fit-content;
  min-height: 32px;
  margin: 8px 0 2px;
  padding: 6px 12px;
  border: 1px solid rgba(133, 43, 34, .18);
  border-radius: 999px;
  color: #6d1f1a;
  background: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.yrfc-detail-btn:hover {
  color: #fff8ed;
  background: linear-gradient(135deg, #1d1715, #8d2a23);
}

.forum-card.yrfc-focus {
  outline: 3px solid rgba(133, 43, 34, .28);
  outline-offset: 4px;
}

/* Instant fallback: applies before JS adds yrfc-compact-card. */
#forum-feed > article:not(.is-open) .forum-content,
#forum-feed .forum-card:not(.is-open) .forum-content {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  max-height: 3.6em !important;
}

#forum-feed > article:not(.is-open) .forum-images,
#forum-feed .forum-card:not(.is-open) .forum-images {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center !important;
  width: auto !important;
  max-width: 180px !important;
  margin: 8px 0 4px !important;
  gap: 0 !important;
}

#forum-feed > article:not(.is-open) .forum-images img,
#forum-feed .forum-card:not(.is-open) .forum-images img {
  width: 104px !important;
  height: 76px !important;
  min-width: 104px !important;
  max-width: 104px !important;
  max-height: 76px !important;
  object-fit: cover !important;
  border-radius: 10px !important;
}

#forum-feed > article:not(.is-open) .forum-images img:nth-child(n+2),
#forum-feed .forum-card:not(.is-open) .forum-images img:nth-child(n+2) {
  display: none !important;
}

#forum-feed > article:not(.is-open) .forum-images[data-count]::after,
#forum-feed .forum-card:not(.is-open) .forum-images[data-count]::after {
  content: "共 " attr(data-count) " 图";
  align-self: flex-end;
  margin-left: 8px;
  white-space: nowrap;
  color: rgba(62, 45, 34, .58);
  font-size: 12px;
  font-weight: 800;
}

#forum-feed > article:not(.is-open) .reaction-row,
#forum-feed > article:not(.is-open) .comment-list,
#forum-feed > article:not(.is-open) .comment-form,
#forum-feed .forum-card:not(.is-open) .reaction-row,
#forum-feed .forum-card:not(.is-open) .comment-list,
#forum-feed .forum-card:not(.is-open) .comment-form {
  display: none !important;
}

#forum-feed > article.yrfc-compact-card:not(.is-open) .forum-content,
#forum-feed .forum-card.yrfc-compact-card:not(.is-open) .forum-content {
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
  max-height: 3.6em !important;
}

#forum-feed > article.yrfc-compact-card:not(.is-open) .forum-images,
#forum-feed .forum-card.yrfc-compact-card:not(.is-open) .forum-images {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center !important;
  width: auto !important;
  max-width: 180px !important;
  margin: 8px 0 4px !important;
  gap: 0 !important;
}

#forum-feed > article.yrfc-compact-card:not(.is-open) .forum-images img,
#forum-feed .forum-card.yrfc-compact-card:not(.is-open) .forum-images img {
  width: 104px !important;
  height: 76px !important;
  min-width: 104px !important;
  max-width: 104px !important;
  max-height: 76px !important;
  object-fit: cover !important;
  border-radius: 10px !important;
}

#forum-feed > article.yrfc-compact-card:not(.is-open) .reaction-row,
#forum-feed > article.yrfc-compact-card:not(.is-open) .comment-list,
#forum-feed > article.yrfc-compact-card:not(.is-open) .comment-form,
#forum-feed .forum-card.yrfc-compact-card:not(.is-open) .reaction-row,
#forum-feed .forum-card.yrfc-compact-card:not(.is-open) .comment-list,
#forum-feed .forum-card.yrfc-compact-card:not(.is-open) .comment-form {
  display: none !important;
}

@media (max-width: 760px) {
  .yrfc-rank-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    min-height: 34px;
    padding: 6px 8px;
  }

  .yrfc-rank-index {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .yrfc-rank-main b,
  .yrfc-rank-score {
    font-size: 11px;
  }

  .yrfc-rank-row.photo {
    grid-template-columns: 24px 34px minmax(0, 1fr) auto;
  }

  .yrfc-photo-thumb {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
}
