/* Profile customization: accent color (--accent / --accent-rgb set on .profile-themed), banner, favorite server.
   Shared by the profile page and the live preview of the customization page. */
.profile-themed {
    --accent: #38bdf8;
    --accent-rgb: 56, 189, 248;
}

/* Header card with optional banner */
.profile-hero {
    padding: 0 !important;
    overflow: hidden;
    margin-bottom: 25px;
    border-color: rgba(var(--accent-rgb), 0.22) !important;
}
.profile-banner {
    position: relative;
    height: 150px;
    background:
        radial-gradient(circle at 18% 120%, rgba(var(--accent-rgb), 0.55), transparent 55%),
        radial-gradient(circle at 85% -20%, rgba(var(--accent-rgb), 0.35), transparent 50%),
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.28) 0%, rgba(21, 32, 46, 0.6) 70%, #15202e 100%);
}
.profile-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.profile-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, rgba(21, 32, 46, 0.9) 100%);
    pointer-events: none;
}
.profile-hero-body {
    padding: 24px;
}
/* Identity row: avatar | name and meta | actions */
.profile-hero-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
}
.profile-avatar-wrap {
    position: relative;
    display: inline-block;
    justify-self: start;
    width: max-content;
}
.profile-hero-info {
    min-width: 0;
}
.profile-hero-name {
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.7rem, 3.2vw, 2.4rem);
    font-weight: 900;
    line-height: 1.1;
    overflow-wrap: anywhere;
}
.profile-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 0.9rem;
}
.profile-hero-title {
    color: var(--accent);
    font-weight: 700;
}
.profile-hero-sep {
    color: rgba(148, 163, 184, 0.5);
}
.profile-hero-id {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.8rem;
    color: #8b9bb0;
}
.profile-live-voice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(35, 165, 90, 0.15);
    border: 1px solid #23a55a;
    color: #4ade80;
    font-weight: 700;
    font-size: 0.85rem;
    max-width: 100%;
}
.profile-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #23a55a;
    flex-shrink: 0;
}
.profile-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-self: start;
}
.profile-hero.has-banner .profile-hero-body {
    padding-top: 0;
}
.profile-hero.has-banner .profile-avatar-wrap {
    margin-top: -46px;
    z-index: 1;
}
.profile-hero.has-banner .profile-hero-main {
    align-items: start;
}
.profile-hero.has-banner .profile-hero-info,
.profile-hero.has-banner .profile-hero-actions {
    padding-top: 16px;
}

/* Level & XP strip inside the header */
.profile-level {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.profile-level-body {
    flex: 1;
    min-width: 0;
}
.profile-level-line {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 8px;
    color: #ffffff;
    font-size: 0.9rem;
}
.profile-level-line .gray {
    color: #94a3b8;
}


/* Customization page preview (simplified header) */
.profile-hero.has-banner .profile-hero-identity {
    align-items: flex-start !important;
}
.profile-hero.has-banner .profile-hero-identity > div:not(.profile-avatar-wrap) {
    padding-top: 14px;
}

.profile-themed .big-pp {
    border-color: rgba(var(--accent-rgb), 0.8);
}
.profile-hero.has-banner .big-pp {
    width: 116px;
    height: 116px;
    min-width: 116px;
    box-shadow: 0 0 0 5px #15202e, 0 10px 28px rgba(0, 0, 0, 0.55);
}

/* Favorite server pill */
.profile-fav-server {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 5px 12px 5px 5px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.86rem;
    max-width: 100%;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.profile-fav-server:hover {
    background: rgba(var(--accent-rgb), 0.18);
    border-color: rgba(var(--accent-rgb), 0.55);
    color: #ffffff;
}
.profile-fav-server img {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.profile-fav-server-label {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.profile-fav-server-name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.profile-fav-server-meta {
    color: #94a3b8;
    white-space: nowrap;
}

/* Owner-only button */
.btn-customize-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(var(--accent-rgb), 0.12);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    color: var(--accent);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-customize-profile:hover {
    background: rgba(var(--accent-rgb), 0.22);
    border-color: var(--accent);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Accent applied to the level card, tabs and toggles */
.profile-themed .user-level-circle {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 55%, #1e1b4b) 0%, var(--accent) 100%);
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.4);
}
.profile-themed .user-level-pct {
    color: var(--accent);
}
.profile-themed .user-xp-bar-fill {
    background: linear-gradient(90deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 55%, #ffffff) 100%);
}
.profile-themed .graphs-tab-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.35);
}
.profile-themed .graphs-tab-btn.active {
    background: rgba(var(--accent-rgb), 0.16);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.2);
}
.profile-themed .graphs-tab-btn.active .tab-badge {
    background: rgba(var(--accent-rgb), 0.3);
}
.profile-themed .granularity-btn.active {
    background: var(--accent);
    box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.35);
}

/* Activity calendar in the member's color (the default look keeps the familiar green scale) */
.profile-themed.accent-custom .heatmap-level-1 { background: color-mix(in srgb, var(--accent) 26%, #15202e); }
.profile-themed.accent-custom .heatmap-level-2 { background: color-mix(in srgb, var(--accent) 48%, #15202e); }
.profile-themed.accent-custom .heatmap-level-3 { background: color-mix(in srgb, var(--accent) 74%, #15202e); }
.profile-themed.accent-custom .heatmap-level-4 { background: var(--accent); box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.5); }

@media (max-width: 600px) {
    .profile-banner {
        height: 110px;
    }
    .profile-hero-body {
        padding: 18px;
    }
    .profile-hero.has-banner .profile-avatar-wrap {
        margin-top: -38px;
    }
    .profile-hero.has-banner .big-pp {
        width: 84px;
        height: 84px;
        min-width: 84px;
    }
}

/* The live preview toggles these with the hidden attribute */
.profile-banner[hidden],
.profile-banner img[hidden],
.profile-fav-server[hidden] {
    display: none !important;
}

/* Badge showcase (bottom of the header card) */
.profile-showcase {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 18px;
}
.profile-showcase-item {
    --rarity: 16, 185, 129;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 8px;
    border-radius: 14px;
    background: rgba(var(--rarity), 0.08);
    border: 1px solid rgba(var(--rarity), 0.35);
    min-width: 0;
    cursor: default;
}
.profile-showcase-item.rarity-rare { --rarity: 56, 189, 248; }
.profile-showcase-item.rarity-epic { --rarity: 192, 132, 252; }
.profile-showcase-item.rarity-legendary { --rarity: 251, 191, 36; box-shadow: 0 0 18px rgba(251, 191, 36, 0.12); }
.profile-showcase-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: rgb(var(--rarity));
    background: rgba(var(--rarity), 0.14);
}
.profile-showcase-icon svg {
    width: 20px;
    height: 20px;
}
.profile-showcase-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.profile-showcase-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-showcase-rarity {
    color: rgb(var(--rarity));
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Pinned records */
.profile-records {
    margin-bottom: 25px;
}
.profile-records-title {
    margin: 0 0 12px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 800;
}
.profile-records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.profile-record {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border-radius: 16px;
    background: #15202e;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-top: 3px solid rgba(var(--accent-rgb), 0.85);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 0;
}
.profile-record-icon {
    color: var(--accent);
    display: inline-flex;
    margin-bottom: 4px;
}
.profile-record-label {
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.profile-record-value {
    color: #ffffff;
    font-size: 1.45rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-record-value small {
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 600;
}
.profile-record-sub {
    color: #8b9bb0;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .profile-records-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .profile-record {
        padding: 12px 14px;
    }
    .profile-record-value {
        font-size: 1.15rem;
    }
}

/* Layout: blocks hidden from visitors (only the owner sees them, tagged) and private mode */
.layout-hidden-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    border: 1px dashed rgba(148, 163, 184, 0.45);
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 700;
    vertical-align: middle;
    letter-spacing: 0;
    text-transform: none;
}
.profile-showcase + .layout-hidden-tag,
.profile-hero-body > .layout-hidden-tag {
    margin-top: 16px;
}
.layout-block-hidden > .layout-hidden-tag {
    margin-bottom: 8px;
}
.layout-block-hidden > :not(.layout-hidden-tag) {
    opacity: 0.6;
}
.profile-private-notice {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px !important;
    margin-bottom: 25px;
    color: var(--accent);
}
.profile-private-title {
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 2px;
}
.profile-private-owner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px dashed rgba(148, 163, 184, 0.4);
    color: #cbd5e1;
    font-size: 0.9rem;
}
.profile-private-owner a {
    color: var(--accent);
    font-weight: 700;
}
.layout-pane-tag {
    margin-bottom: 14px;
}

/* Phones: the 3 showcase badges sit side by side as compact tiles */
@media (max-width: 600px) {
    .profile-showcase {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .profile-showcase-item {
        flex-direction: column;
        text-align: center;
        gap: 6px;
        padding: 10px 6px;
    }
    .profile-showcase-text {
        align-items: center;
        max-width: 100%;
    }
    .profile-showcase-name {
        white-space: normal;
        font-size: 0.78rem;
        line-height: 1.2;
    }
    .profile-showcase-rarity {
        font-size: 0.64rem;
    }
}

@media (max-width: 760px) {
    .profile-hero-main {
        grid-template-columns: auto minmax(0, 1fr);
    }
    .profile-hero-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-top: 0 !important;
    }
}
@media (max-width: 600px) {
    .profile-hero-main {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .profile-hero.has-banner .profile-hero-info {
        padding-top: 0;
    }
    .profile-level {
        padding: 10px 12px;
    }
    .profile-hero-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .profile-hero-sep,
    .profile-level-target {
        display: none;
    }
}
.profile-level-next {
    white-space: nowrap;
}

/* Streaks strip (Activity tab) */
.profile-streaks {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px 8px !important;
    margin-top: 0 !important;
    margin-bottom: 25px !important;
}
.profile-streak {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    min-width: 0;
}
.profile-streak + .profile-streak {
    border-left: 1px solid rgba(255, 255, 255, 0.07);
}
.profile-streak-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.profile-streak-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.profile-streak-label {
    color: #94a3b8;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.profile-streak-value {
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.25;
}
.profile-streak-value small {
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
}
.profile-streak-sub {
    color: #8b9bb0;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 900px) {
    .profile-streaks {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 18px;
    }
    .profile-streak:nth-child(3) {
        border-left: none;
    }
}
@media (max-width: 420px) {
    .profile-streak {
        padding: 0 10px;
        gap: 8px;
    }
    .profile-streak-icon {
        display: none;
    }
}

/* Phones: profile totals stay in a 2x2 grid with compact cards (instead of 4 full-width rows) */
@media (max-width: 600px) {
    .profile-themed .home-stats-container.stats-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .profile-themed .home-stats-container.stats-4 .home-stats-box {
        padding: 12px;
        gap: 10px;
    }
    .profile-themed .home-stats-container.stats-4 .home-stats-icon {
        display: none;
    }
}

/* Vitrine: the member's own picks, visually set apart by an accent frame */
.profile-vitrine {
    position: relative;
    margin-bottom: 25px;
    padding: 20px 22px 22px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 0% 0%, rgba(var(--accent-rgb), 0.16), transparent 45%),
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), rgba(21, 32, 46, 0.9) 60%),
        #15202e;
    border: 1px solid rgba(var(--accent-rgb), 0.45);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.06), 0 10px 30px rgba(0, 0, 0, 0.35);
}
.profile-vitrine-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-bottom: 16px;
}
.profile-vitrine-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 800;
}
.profile-vitrine-title svg {
    color: var(--accent);
    transform: rotate(35deg);
}
.profile-vitrine-edit {
    margin-left: auto;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}
.profile-vitrine-edit:hover {
    text-decoration: underline;
}
.profile-vitrine-top {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    margin-bottom: 18px;
}
.profile-vitrine-top:last-child {
    margin-bottom: 0;
}
.profile-vitrine-part {
    min-width: 0;
}
.profile-vitrine-top > .profile-vitrine-part:first-child {
    flex: 1 1 380px;
}
.profile-vitrine-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #94a3b8;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.profile-vitrine .profile-showcase {
    padding-top: 0;
}
.profile-vitrine-server {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    border-radius: 14px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    color: #ffffff;
    text-decoration: none;
    max-width: 320px;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.profile-vitrine-server:hover {
    background: rgba(var(--accent-rgb), 0.16);
    border-color: rgba(var(--accent-rgb), 0.6);
    color: #ffffff;
}
.profile-vitrine-server img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}
.profile-vitrine-server-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.profile-vitrine-server-name {
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-vitrine-server-meta {
    color: #94a3b8;
    font-size: 0.82rem;
}
.profile-vitrine .profile-record {
    background: rgba(15, 23, 34, 0.55);
    box-shadow: none;
}
@media (max-width: 600px) {
    .profile-vitrine {
        padding: 16px;
    }
    .profile-vitrine-edit {
        margin-left: 0;
        width: 100%;
    }
    .profile-vitrine-server {
        max-width: none;
    }
}

/* Page background picked from the gallery (behind the whole page, darker towards the content) */
.profile-backdrop {
    position: fixed;
    /* Slightly larger than the screen so the blurred edges never show a dark fringe */
    inset: -24px;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(5, 9, 13, 0) 0%, rgba(5, 9, 13, 0.25) 50%, rgba(5, 9, 13, 0.55) 100%),
        var(--backdrop) center / cover no-repeat;
    /* Soft focus: the picture stays recognisable but never competes with the content */
    filter: blur(6px);
}
