/* -- Session social reward ------------------------- */
.social-summary-card {
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 14px;
    background: linear-gradient(135deg, #f6f2ff 0%, #eefbf8 100%);
    color: #2d3436;
}

.social-summary-card[hidden],
.social-summary-panel[hidden],
.social-summary-streak[hidden],
.social-summary-leaderboard-empty[hidden] {
    display: none;
}

.social-summary-panel {
    padding: 0.85rem;
}

.social-summary-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 4.6rem;
    color: #6555ca;
}

.social-summary-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(108, 92, 231, 0.18);
    border-top-color: #6c5ce7;
    border-radius: 50%;
    animation: socialSpin 0.75s linear infinite;
}

.social-summary-success {
    display: grid;
    gap: 0.7rem;
}

.session-celebration .social-summary-panel {
    padding: 0.72rem;
}

.session-celebration .social-summary-success {
    gap: 0.55rem;
}

.session-celebration .social-summary-reward strong {
    font-size: 1.35rem;
}

.session-celebration .social-summary-streak {
    gap: 0.5rem;
    padding: 0.62rem;
}

.session-celebration .social-summary-leaderboard {
    padding-top: 0.55rem;
}

.session-celebration .social-summary-leaderboard-list {
    max-height: 9rem;
}

.social-summary-success.is-revealed {
    animation: socialRewardReveal 650ms cubic-bezier(0.2, 0.82, 0.2, 1) both;
}

.social-summary-reward {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.social-summary-reward span {
    display: block;
    color: #7f726c;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1.2;
}

.social-summary-reward strong {
    color: #0d8f75;
    font-size: 1.9rem;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.social-summary-streak {
    display: grid;
    gap: 0.65rem;
    padding: 0.72rem;
    border: 1px solid rgba(225, 112, 85, 0.2);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 250, 241, 0.98), rgba(255, 239, 231, 0.9));
}

.social-summary-streak-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
}

.social-summary-streak-icon {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #fff;
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(172, 84, 57, 0.12);
}

.social-summary-streak-header > div > span,
.social-summary-leaderboard-header > span {
    display: block;
    color: #8b766e;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.social-summary-streak h3,
.social-summary-leaderboard h3 {
    margin: 0.08rem 0 0;
    color: #403735;
    font-size: 0.94rem;
    font-weight: 950;
    line-height: 1.2;
}

.social-summary-streak-current {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    margin: 0;
    color: #b4553d;
    font-size: 0.72rem;
    font-weight: 900;
}

.social-summary-streak-current strong {
    font-size: 1.45rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.social-summary-streak-trail {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.social-summary-streak-day {
    display: grid;
    justify-items: center;
    gap: 0.18rem;
    min-width: 0;
    padding: 0.3rem 0.12rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #9a8982;
}

.social-summary-streak-day.is-today {
    border-color: rgba(225, 112, 85, 0.32);
    background: rgba(255, 255, 255, 0.68);
}

.social-summary-streak-mark {
    display: grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: rgba(186, 165, 155, 0.14);
    font-size: 0.72rem;
    font-weight: 950;
}

.social-summary-streak-day.is-done .social-summary-streak-mark {
    background: #e17055;
    color: #fff;
}

.social-summary-streak-date {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.62rem;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.social-summary-leaderboard {
    display: grid;
    gap: 0.45rem;
    padding-top: 0.68rem;
    border-top: 1px solid rgba(108, 92, 231, 0.14);
}

.social-summary-leaderboard-list {
    display: grid;
    gap: 0.28rem;
    max-height: 16rem;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    scrollbar-gutter: stable;
}

.social-summary-leaderboard-list li {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    padding: 0.48rem 0.5rem;
    border-radius: 8px;
    color: #756964;
    font-size: 0.78rem;
    font-weight: 800;
}

.social-summary-leaderboard-list li.is-viewer {
    background: #fff;
    color: #5948c7;
    box-shadow: inset 3px 0 0 #6c5ce7;
}

.social-summary-leaderboard-list strong {
    display: inline-flex;
    align-items: center;
    gap: 0.58rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.social-summary-leaderboard-avatar {
    display: inline-grid;
    flex: 0 0 auto;
    width: 2.55rem;
    height: 2.55rem;
    place-items: center;
    border-radius: 50%;
    background: #f0ebff;
    font-size: 1.35rem;
    line-height: 1;
    overflow: hidden;
}

.social-summary-leaderboard-avatar img,
.social-rank-avatar img,
.social-feed-avatar img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.social-avatar-button {
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: zoom-in;
}

.social-avatar-button:focus-visible {
    outline: 3px solid rgba(108, 92, 231, 0.38);
    outline-offset: 2px;
}

.social-avatar-lightbox {
    width: min(92vw, 760px);
    max-width: none;
    max-height: 92dvh;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 22px;
    overflow: visible;
    background: transparent;
    color: #fff;
}

.social-avatar-lightbox::backdrop {
    background: rgba(20, 18, 28, 0.82);
    backdrop-filter: blur(5px);
}

.social-avatar-lightbox-panel {
    position: relative;
    display: grid;
    gap: 0.7rem;
    padding: 0.75rem;
    border-radius: 22px;
    background: #24212e;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.social-avatar-lightbox img {
    display: block;
    width: 100%;
    max-height: calc(92dvh - 5rem);
    aspect-ratio: 1;
    border-radius: 16px;
    object-fit: contain;
    background: #17151d;
}

.social-avatar-lightbox p {
    margin: 0;
    padding: 0 0.35rem 0.25rem;
    overflow-wrap: anywhere;
    font-weight: 900;
    text-align: center;
}

.social-avatar-lightbox-close {
    position: absolute;
    z-index: 1;
    top: -0.7rem;
    right: -0.7rem;
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    place-items: center;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #6c5ce7;
    color: #fff;
    font: inherit;
    font-size: 1.65rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.social-summary-leaderboard-rank,
.social-summary-leaderboard-points {
    font-variant-numeric: tabular-nums;
}

.social-summary-leaderboard-points {
    text-align: end;
}

.social-summary-leaderboard-empty {
    margin: 0;
    color: #81746f;
    font-size: 0.78rem;
    font-weight: 800;
}

.social-summary-link,
.social-summary-actions a,
.social-summary-retry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.45rem;
    border: 0;
    border-radius: 10px;
    padding: 0.5rem 0.8rem;
    background: #6c5ce7;
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.social-summary-message {
    display: grid;
    gap: 0.45rem;
    color: #5f5551;
    text-align: center;
}

.social-summary-message > strong {
    color: #403735;
}

.social-summary-message p {
    margin: 0;
    color: #81746f;
    font-size: 0.84rem;
    font-weight: 750;
    line-height: 1.35;
}

.social-summary-actions {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
}

.social-summary-actions a:first-child {
    border: 1px solid rgba(108, 92, 231, 0.24);
    background: #fff;
    color: #5948c7;
}

/* -- Community page -------------------------------- */
.account-page-community {
    width: min(100%, 1180px);
}

.social-community {
    display: grid;
    gap: 1rem;
}

.social-community-hero,
.social-card,
.social-community-highlights article {
    border: 2px solid #f0e4df;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 34px rgba(201, 142, 104, 0.11);
}

.social-community-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.3rem;
    border-radius: 20px;
}

.social-community-hero h1 {
    margin: 0;
    color: #e17055;
    text-align: start;
}

.social-community-hero p {
    margin-top: 0.35rem;
    color: #82756f;
    font-weight: 750;
    line-height: 1.4;
}

.social-community-viewer {
    display: grid;
    flex: 0 1 auto;
    min-width: 10rem;
    gap: 0.12rem;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    background: #f5f1ff;
    color: #5948c7;
    text-align: end;
}

.social-community-viewer strong {
    overflow-wrap: anywhere;
    font-size: 1.05rem;
    font-weight: 950;
}

.social-community-viewer span {
    color: #887db6;
    font-size: 0.72rem;
    font-weight: 850;
}

.social-community-highlights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.social-community-highlights article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.12rem 0.75rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
}

.social-community-highlights span {
    color: #756963;
    font-size: 0.8rem;
    font-weight: 900;
}

.social-community-highlights strong {
    grid-row: span 2;
    color: #0d8f75;
    font-size: 2rem;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.social-community-highlights small {
    color: #8d817c;
    font-size: 0.75rem;
    font-weight: 800;
}

.social-community-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
    gap: 1rem;
}

.social-card {
    min-width: 0;
    padding: 1.15rem;
    border-radius: 18px;
}

.social-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.85rem;
}

.social-card-header h1,
.social-card-header h2 {
    margin: 0;
    color: #2d3436;
    font-size: 1.12rem;
    font-weight: 950;
}

.social-card-header h1 {
    font-size: 1.28rem;
}

.social-period-tabs {
    display: inline-flex;
    padding: 0.2rem;
    border-radius: 12px;
    background: #f2edeb;
}

.social-period-tabs a {
    min-height: 2.15rem;
    padding: 0.48rem 0.65rem;
    border-radius: 9px;
    color: #82756f;
    font-size: 0.75rem;
    font-weight: 900;
    text-decoration: none;
}

.social-period-tabs a[aria-current="page"] {
    background: #fff;
    color: #5948c7;
    box-shadow: 0 3px 10px rgba(80, 64, 61, 0.09);
}

.social-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.social-rank-table,
.social-chart-data table {
    width: 100%;
    border-collapse: collapse;
    color: #514641;
    font-size: 0.86rem;
}

.social-rank-table th,
.social-rank-table td,
.social-chart-data th,
.social-chart-data td {
    padding: 0.72rem 0.55rem;
    border-bottom: 1px solid #efe5df;
    text-align: start;
}

.social-rank-table thead th,
.social-chart-data thead th {
    color: #8b7d77;
    font-size: 0.7rem;
    font-weight: 950;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.social-rank-table tbody th {
    overflow-wrap: anywhere;
    font-weight: 900;
}

.social-rank-person {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.social-rank-avatar {
    display: inline-grid;
    flex: 0 0 auto;
    width: 3.35rem;
    height: 3.35rem;
    place-items: center;
    border-radius: 50%;
    background: #f0ebff;
    font-size: 1.8rem;
    line-height: 1;
    overflow: hidden;
}

.social-rank-avatar.compact {
    width: 2.85rem;
    height: 2.85rem;
    font-size: 1.5rem;
}

.social-rank-table tbody tr.is-viewer {
    background: #f4f1ff;
    color: #5948c7;
}

.social-rank-table tbody tr.is-viewer > :first-child {
    border-start-start-radius: 9px;
    border-end-start-radius: 9px;
}

.social-rank-table tbody tr.is-viewer > :last-child {
    border-start-end-radius: 9px;
    border-end-end-radius: 9px;
}

.social-rank-number,
.social-rank-points {
    width: 5.3rem;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.social-rank-points {
    color: #0d8f75;
    text-align: end !important;
}

.social-table-empty,
.social-empty {
    padding: 1rem !important;
    color: #8d817c;
    font-weight: 750;
    line-height: 1.4;
    text-align: center !important;
}

.social-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    color: #8b7e78;
    font-size: 0.75rem;
    font-weight: 850;
    text-align: center;
}

.social-pagination a,
.social-pagination > span[aria-disabled="true"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.3rem;
    border-radius: 9px;
    padding: 0.45rem 0.65rem;
    background: #f5f1ff;
    color: #5948c7;
    font-weight: 900;
    text-decoration: none;
}

.social-pagination a:first-child,
.social-pagination > span:first-child {
    justify-self: start;
}

.social-pagination a:last-child,
.social-pagination > span:last-child {
    justify-self: end;
}

.social-pagination > span[aria-disabled="true"] {
    color: #aaa09b;
    opacity: 0.7;
}

.social-neighborhood {
    margin-top: 0.9rem;
    padding-top: 0.85rem;
    border-top: 1px solid #efe5df;
}

.social-neighborhood h3 {
    margin: 0 0 0.45rem;
    color: #756963;
    font-size: 0.78rem;
    font-weight: 950;
}

.social-neighborhood ol {
    display: grid;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.social-neighborhood li {
    display: grid;
    grid-template-columns: 2.8rem minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
    padding: 0.55rem 0.5rem;
    border-radius: 9px;
    color: #81756f;
    font-size: 0.78rem;
    font-weight: 800;
}

.social-neighborhood li.is-viewer {
    background: #f4f1ff;
    color: #5948c7;
}

.social-neighborhood-rank {
    font-variant-numeric: tabular-nums;
}

.social-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem 0.75rem;
    margin: 0 0 0.65rem;
    padding: 0;
    list-style: none;
    color: #746863;
    font-size: 0.73rem;
    font-weight: 850;
}

.social-chart-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.social-chart-legend li.is-viewer {
    color: #5948c7;
    font-weight: 950;
}

.social-series-swatch {
    width: 1.35rem;
    height: 0.22rem;
    border-radius: 999px;
    background: #6c5ce7;
}

.social-series-1 { background: #00a889; }
.social-series-2 { background: #d66a55; }
.social-series-3 { background: #287bb5; }
.social-series-4 { background: #9b6b24; }

.social-chart-frame {
    position: relative;
    width: 100%;
    min-height: 270px;
    border: 1px solid #eee4de;
    border-radius: 13px;
    background: linear-gradient(180deg, #fff 0%, #fffdfb 100%);
}

.social-chart-frame canvas {
    display: block;
    width: 100%;
    height: 270px;
}

.social-chart-data {
    margin-top: 0.7rem;
    color: #746863;
    font-size: 0.78rem;
    font-weight: 850;
}

.social-chart-data summary {
    min-height: 2rem;
    padding: 0.35rem 0;
    cursor: pointer;
}

.social-chart-data .social-table-wrap {
    margin-top: 0.35rem;
}

.social-chart-data th,
.social-chart-data td {
    min-width: 4.5rem;
    white-space: nowrap;
}

.social-feed-list {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.social-feed-list > li {
    display: grid;
    grid-template-columns: 3.7rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.78rem;
    border: 1px solid #efe5df;
    border-radius: 12px;
    background: #fffdfb;
}

.social-feed-avatar {
    display: grid;
    place-items: center;
    width: 3.65rem;
    height: 3.65rem;
    border-radius: 50%;
    background: #f0ebff;
    color: #5948c7;
    font-weight: 950;
    overflow: hidden;
}

.social-feed-copy {
    display: grid;
    min-width: 0;
    gap: 0.08rem;
    color: #746863;
    font-size: 0.8rem;
    font-weight: 750;
}

.social-feed-copy strong {
    overflow-wrap: anywhere;
    color: #3c3431;
    font-size: 0.9rem;
    font-weight: 950;
}

.social-feed-copy time {
    color: #9a8e88;
    font-size: 0.7rem;
}

.social-feed-points {
    color: #0d8f75;
    font-size: 1.05rem;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

@keyframes socialSpin {
    to { transform: rotate(360deg); }
}

@keyframes socialRewardReveal {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 860px) {
    .social-community-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .account-page-community {
        width: 100%;
    }

    .social-community-hero {
        display: grid;
        padding: 1rem;
    }

    .social-community-viewer {
        width: 100%;
        min-width: 0;
        text-align: start;
    }

    .social-community-highlights {
        grid-template-columns: 1fr;
    }

    .social-card {
        padding: 0.9rem;
    }

    .social-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .social-period-tabs {
        width: 100%;
    }

    .social-period-tabs a {
        flex: 1 1 50%;
        text-align: center;
    }

    .social-chart-frame,
    .social-chart-frame canvas {
        min-height: 230px;
        height: 230px;
    }

}

@media (max-width: 390px) {
    .social-rank-table th,
    .social-rank-table td {
        padding-inline: 0.38rem;
    }

    .social-rank-number,
    .social-rank-points {
        width: auto;
    }

    .social-neighborhood li,
    .social-summary-leaderboard-list li {
        grid-template-columns: 2.4rem minmax(0, 1fr) auto;
        gap: 0.35rem;
    }

    .social-feed-list > li {
        grid-template-columns: 3.25rem minmax(0, 1fr) auto;
        gap: 0.55rem;
    }

    .social-feed-avatar {
        width: 3.2rem;
        height: 3.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .social-summary-spinner {
        animation-duration: 1.5s;
    }

    .social-summary-success.is-revealed {
        animation: none;
    }
}
