/* ===== 커뮤니티 활동 랭킹 ===== */
.ranking-page {
    max-width: 1000px;
    margin: 0 auto;
}

/* 헤더 */
.ranking-page__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.ranking-page__title {
    font-size: 26px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 8px;
}

.ranking-page__desc {
    font-size: 14px;
    color: #9ca3af;
    line-height: 1.5;
    margin: 0;
}

.ranking-page__tabs {
    display: inline-flex;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
    flex-shrink: 0;
}

.ranking-page__tab {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    border-radius: 7px;
    text-decoration: none;
    white-space: nowrap;
    transition: all .15s;
}

.ranking-page__tab:hover {
    color: #111827;
}

.ranking-page__tab.is-active {
    background: #eef2ff;
    color: #1f5af2;
}

/* 2단 그리드 */
.ranking-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 카드 */
.rank-card {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 16px;
    padding: 22px 22px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.rank-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.rank-card__head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rank-card__icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 15px;
}

.rank-card__icon--post {
    background: #eef2ff;
}

.rank-card__icon--comment {
    background: #f3ecff;
}

.rank-card__title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.rank-card--post .rank-card__title {
    color: #1f5af2;
}

.rank-card--comment .rank-card__title {
    color: #7c3aed;
}

.rank-card__sub {
    font-size: 12px;
    color: #9ca3af;
    margin: 2px 0 0;
}

/* 포디움 */
.rank-podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: end;
    gap: 6px;
    margin-bottom: 20px;
}

.rank-podium__col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.rank-podium__col--1 {
    padding-bottom: 6px;
}

.rank-podium__col.is-empty {
    min-height: 120px;
}

.rank-podium__crown {
    line-height: 0;
    margin-bottom: 4px;
}

.rank-podium__crown svg {
    width: 20px;
    height: 20px;
    display: block;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .12));
}

.rank-podium__crown--gold svg {
    width: 24px;
    height: 24px;
    color: #f5b301;
}

.rank-podium__crown--silver svg {
    color: #b6bcc6;
}

.rank-podium__crown--bronze svg {
    color: #cf8a4e;
}

.rank-podium__avatar-wrap {
    position: relative;
    margin-bottom: 10px;
}

.rank-podium__avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e5e7eb, #cbd5e1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #e5e7eb;
}

.rank-podium__avatar--gold {
    width: 66px;
    height: 66px;
    font-size: 24px;
}

.rank-podium__avatar-wrap--gold {
    box-shadow: none;
}

.rank-podium__avatar-wrap--gold .rank-podium__avatar {
    box-shadow: 0 0 0 3px #93b4ff;
}

.rank-podium__avatar-wrap--comment.rank-podium__avatar-wrap--gold .rank-podium__avatar {
    box-shadow: 0 0 0 3px #c4a7fb;
}

.rank-podium__badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.rank-podium__badge--gold {
    background: #f5b301;
}

.rank-podium__badge--silver {
    background: #9ca3af;
}

.rank-podium__badge--bronze {
    background: #d08b4f;
}

.rank-podium__name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 2px;
}

.rank-podium__count {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 600;
}

.rank-podium__count--gold {
    color: #1f5af2;
}

.rank-card--comment .rank-podium__count--gold {
    color: #7c3aed;
}

/* 4위 이하 리스트 */
.rank-rows {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    border-top: 1px solid #f1f2f4;
}

.rank-rows__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 4px;
    border-bottom: 1px solid #f5f6f7;
    font-size: 13px;
}

.rank-rows__rank {
    width: 18px;
    color: #6b7280;
    font-weight: 700;
    text-align: center;
}

.rank-rows__name {
    flex: 1;
    color: #374151;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-rows__count {
    color: #6b7280;
    font-weight: 600;
}

.rank-rows__change {
    width: 36px;
    text-align: right;
    font-size: 11px;
    font-weight: 700;
}

.rank-rows__change.is-up {
    color: #ef4444;
}

.rank-rows__change.is-down {
    color: #3b82f6;
}

.rank-rows__change.is-none {
    color: #d1d5db;
}

/* 내 순위 */
.rank-mine {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: 13px;
}

.rank-card--post .rank-mine {
    background: #f3f6ff;
}

.rank-card--comment .rank-mine {
    background: #f7f3ff;
}

.rank-mine__label {
    color: #6b7280;
    font-weight: 600;
}

.rank-mine__rank {
    font-weight: 800;
    color: #111827;
}

.rank-card--post .rank-mine__rank {
    color: #1f5af2;
}

.rank-card--comment .rank-mine__rank {
    color: #7c3aed;
}

.rank-mine__divider {
    color: #d1d5db;
}

.rank-mine__name {
    color: #374151;
    font-weight: 600;
}

.rank-mine__count {
    margin-left: auto;
    font-weight: 700;
}

.rank-card--post .rank-mine__count {
    color: #1f5af2;
}

.rank-card--comment .rank-mine__count {
    color: #7c3aed;
}

/* 빈 상태 */
.rank-empty {
    text-align: center;
    padding: 40px 0;
    color: #9ca3af;
    font-size: 14px;
}

/* ===== 인기 게시글 랭킹 ===== */
.popular {
    margin-top: 20px;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.popular__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.popular__head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.popular__icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #fff2e8;
    font-size: 17px;
}

.popular__title {
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    margin: 0;
}

.popular__sub {
    font-size: 12px;
    color: #9ca3af;
    margin: 2px 0 0;
}

.popular__my {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: #fff2e8;
    color: #d9731a;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.popular__body {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}

/* 1위 히어로 카드 */
.popular__hero {
    display: block;
    border: 2px solid #ffd9a8;
    border-radius: 14px;
    padding: 16px;
    background: #fffaf3;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s;
}

.popular__hero:hover {
    box-shadow: 0 4px 14px rgba(217, 115, 26, .15);
}

.popular__hero-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.popular__hero-rank {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: #f5b301;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.popular__hero-hot {
    font-size: 11px;
    font-weight: 700;
    color: #d9731a;
}

.popular__hero-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.popular__hero-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular__hero-thumb-empty {
    font-size: 34px;
    opacity: .5;
}

.popular__hero-title {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
    line-height: 1.4;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular__hero-author {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #6b7280;
}

.popular__hero-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.popular__hero-name {
    font-weight: 700;
    color: #374151;
}

.popular__hero-stats {
    display: flex;
    gap: 8px;
}

.popular__stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #f0e6d8;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
}

.popular__stat--like {
    color: #ef4444;
}

/* 2~10위 리스트 */
.popular__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popular__list.is-scrolling {
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
}

.popular__list.is-scrolling.is-end {
    -webkit-mask-image: none;
    mask-image: none;
}

.popular__list.is-scrolling::-webkit-scrollbar {
    display: none;
}

.popular__list.is-scrolling > li {
    flex-shrink: 0;
    scroll-snap-align: start;
}

.popular__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #f1f2f4;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background .15s, border-color .15s;
}

.popular__row:hover {
    background: #fafbfc;
    border-color: #e5e7eb;
}

.popular__row-rank {
    width: 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    color: #374151;
    flex-shrink: 0;
}

.popular__row-thumb {
    width: 52px;
    height: 40px;
    border-radius: 7px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popular__row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular__row-thumb-empty {
    font-size: 16px;
    opacity: .5;
}

.popular__row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.popular__row-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popular__row-meta {
    font-size: 11px;
    color: #9ca3af;
}

.popular__row-like {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: #ef4444;
}

/* 하단 배너 */
.ranking-banner {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(90deg, #eef2ff, #f5f0ff);
    border-radius: 14px;
    text-align: center;
}

.ranking-banner span {
    font-size: 18px;
}

.ranking-banner p {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
}

/* 반응형 */
@media (max-width: 820px) {
    .ranking-grid {
        grid-template-columns: 1fr;
    }

    .popular__body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .ranking-page__header {
        flex-direction: column;
    }

    .ranking-page__tabs {
        width: 100%;
        justify-content: space-between;
    }

    .ranking-banner p {
        text-align: left;
        font-size: 12px;
    }
}
