/* Sidebar Base */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    height: 100dvh;
    background: #0a0a0f;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    position: relative;
    flex-shrink: 0;
    min-height: 64px;
    overflow: hidden;
}
.sidebar-logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.08) 20%,
        rgba(255, 255, 255, 0.08) 80%,
        transparent);
    pointer-events: none;
}

.sidebar-logo img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.18);
}

.sidebar-logo .logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #5DADE2;
    white-space: nowrap;
}

/* display:inline-block below outranks the UA's [hidden] rule, so restate it. */
.logo-ai[hidden] {
    display: none;
}

.logo-ai {
    font-size: 0.45em;
    font-weight: 800;
    color: #9b72cf;
    margin-left: 2px;
    display: inline-block;
    position: relative;
    top: -0.75em;
    line-height: 1;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-section {
    margin-bottom: 20px;
}
.nav-section + .nav-section {
    margin-top: 4px;
}

.nav-section-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.56);
    padding: 0 14px;
    margin-bottom: 10px;
    white-space: nowrap;
}
.nav-section-label::before {
    content: '';
    width: 16px;
    height: 1px;
    background: rgba(255, 255, 255, 0.25);
}

/* Nav Items — brand-tinted active state, quiet hover, matches
   the dashboard's bb-card vocabulary. */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    margin-bottom: 4px;
    border-radius: 12px;
    color: var(--text-light);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.18s var(--ease-lift), color 0.18s ease, border-color 0.18s ease;
    position: relative;
    overflow: hidden;
}
.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.22s var(--ease-lift), transform 0.22s var(--ease-lift);
    box-shadow: 0 0 10px rgba(93, 173, 226, 0.35);
}

.nav-item:hover {
    background: var(--surface-1);
    border-color: var(--border);
    color: var(--text);
}
.nav-expand-caret { margin-left: auto; font-size: 0.5625rem; color: rgba(255,255,255,0.2); transition: color 0.18s ease, transform 0.18s ease; }
.nav-item:hover .nav-expand-caret { color: rgba(255,255,255,0.4); }
.nav-item.active .nav-expand-caret { color: rgba(93,173,226,0.6); }

/* Expandable nav groups */
.nav-group { margin-bottom: 0; }
.nav-group .nav-item.nav-parent { width: 100%; background: none; border: 1px solid transparent; cursor: pointer; text-align: left; font-family: inherit; margin-bottom: 0; }
.nav-group.is-open .nav-parent .nav-expand-caret { transform: rotate(90deg); color: rgba(93,173,226,0.6); }
.nav-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-group.is-open .nav-sub { max-height: 120px; }
.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px 7px 40px;
    border-radius: 9px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
}
.nav-sub-item::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: background 0.15s ease;
}
.nav-sub-item i { display: none; }
.nav-sub-item:hover { background: var(--surface-1); color: var(--text); }
.nav-sub-item:hover::before { background: rgba(93,173,226,0.5); }
.nav-sub-item.active { color: var(--primary); font-weight: 600; }
.nav-sub-item.active::before { background: var(--primary); }

.nav-item.active {
    background: rgba(93, 173, 226, 0.1);
    border-color: rgba(93, 173, 226, 0.2);
    color: var(--text);
    transform: none;
}
.nav-item.active::before {
    opacity: 1;
    transform: translateX(0);
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.25s var(--ease-lift);
}

.nav-icon i {
    font-size: 0.8125rem;
    color: var(--text-light);
    transition: color 0.18s ease;
}

.nav-item:hover .nav-icon {
    background: rgba(93, 173, 226, 0.12);
    border-color: rgba(93, 173, 226, 0.25);
}
.nav-item.active .nav-icon {
    background: rgba(93, 173, 226, 0.18);
    border-color: rgba(93, 173, 226, 0.35);
    box-shadow: 0 4px 14px rgba(93, 173, 226, 0.15);
}

.nav-item:hover .nav-icon i,
.nav-item.active .nav-icon i {
    color: #93c5fd;
}

.nav-text {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: -0.005em;
}

.nav-item.active .nav-text {
    font-weight: 600;
    color: var(--primary);
}

/* Footer — soft fade separator instead of a hard border so it feels
   continuous with the nav above it. */
.sidebar-footer {
    padding: 10px 8px 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.sidebar-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12px;
    right: 12px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.08) 20%,
        rgba(255, 255, 255, 0.08) 80%,
        transparent);
    pointer-events: none;
}

/* Server Switcher — interactive card row */
.server-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.server-switcher:hover {
    background: var(--surface-2);
    border-color: rgba(96, 165, 250, 0.25);
}

.server-icon-mini {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: white;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.server-icon-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.server-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.server-label {
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.52);
}

.server-name {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-arrow {
    color: var(--text-light);
    font-size: 0.625rem;
    opacity: 0.4;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.server-switcher:hover .server-arrow {
    opacity: 1;
    color: var(--primary);
}

/* Premium Badge — calm gold, matches the dashboard's low-alpha
   tinted-card vocabulary instead of an attention-grabbing pill. */
.premium-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.premium-badge i {
    font-size: 0.75rem;
    opacity: 0.9;
}

/* Upgrade Button */
.upgrade-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #1a1a2e;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(251, 191, 36, 0.35);
}

.upgrade-btn i:first-child {
    font-size: 0.875rem;
}

/* User Section — sibling card to the server switcher above */
.user-section {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 12px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    transition: background 0.2s ease, border-color 0.2s ease;
}
.user-section:hover {
    background: var(--surface-2);
    border-color: rgba(96, 165, 250, 0.18);
}

/* Shown in place of the user profile when viewing a public page (docs) signed out. */
.sidebar-signin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}
.sidebar-signin:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    padding: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.user-profile:hover {
    background: rgba(93, 173, 226, 0.08);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    flex-shrink: 0;
    object-fit: cover;
}

.user-avatar-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 0.5625rem;
    color: var(--text-light);
    opacity: 0.6;
}

.user-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.75rem;
}

.action-btn:hover {
    background: rgba(93, 173, 226, 0.12);
    color: var(--primary);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px !important;
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
        height: 100vh;
        height: 100dvh;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Collapsible footer on mobile */
    .sidebar-footer {
        padding: 8px;
        gap: 0;
        flex-shrink: 0;
    }

    /* Compact bar always visible */
    .mobile-footer-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.04);
        cursor: pointer;
        transition: background 0.15s;
    }
    .mobile-footer-bar:hover {
        background: rgba(255, 255, 255, 0.06);
    }
    .mobile-footer-bar .user-avatar,
    .mobile-footer-bar .user-avatar-fallback {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    .mobile-footer-bar .server-icon-mini,
    .mobile-footer-bar .server-icon-img {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }
    .mobile-footer-bar-info {
        flex: 1;
        min-width: 0;
    }
    .mobile-footer-bar-name {
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-footer-bar-server {
        font-size: 0.6875rem;
        color: var(--text-light);
        opacity: 0.7;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-footer-expand {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        color: var(--text-light);
        transition: all 0.2s;
    }
    .mobile-footer-bar:hover .mobile-footer-expand {
        color: var(--primary);
    }
    .sidebar-footer.expanded .mobile-footer-expand {
        transform: rotate(180deg);
    }

    /* Expandable content */
    .mobile-footer-content {
        display: grid;
        grid-template-rows: 0fr;
        transition: grid-template-rows 0.25s ease;
    }
    .sidebar-footer.expanded .mobile-footer-content {
        grid-template-rows: 1fr;
    }
    .mobile-footer-inner {
        overflow: hidden;
    }
    .mobile-footer-items {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding-top: 8px;
    }

    /* Hide desktop footer elements, show mobile ones */
    .sidebar-footer > .tour-help-btn,
    .sidebar-footer > .server-switcher,
    .sidebar-footer > .premium-badge,
    .sidebar-footer > .upgrade-btn,
    .sidebar-footer > .user-section {
        display: none;
    }
    .mobile-footer-bar {
        display: flex;
    }
    .mobile-footer-content {
        display: grid;
    }

    /* Compact styles for items inside expanded menu */
    .mobile-footer-items .tour-help-btn {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    .mobile-footer-items .server-switcher {
        padding: 8px 10px;
    }
    .mobile-footer-items .premium-badge,
    .mobile-footer-items .upgrade-btn {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    .mobile-footer-items .user-section {
        padding: 6px;
    }
    .mobile-footer-items .action-btn {
        width: 32px;
        height: 32px;
    }
}

/* Desktop: hide mobile-only elements */
@media (min-width: 769px) {
    .mobile-footer-bar,
    .mobile-footer-content {
        display: none !important;
    }
}

/* Tour Help Button */
.tour-help-btn {
    width: 100%;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-lift), box-shadow 0.25s var(--ease-lift);
}

.tour-help-btn:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(192, 132, 252, 0.06));
    border-color: rgba(96, 165, 250, 0.3);
    color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(96, 165, 250, 0.12);
}

.tour-help-btn i {
    font-size: 0.875rem;
    color: var(--primary);
}

.tour-help-btn span {
    color: inherit;
}

/* Profile Card Modal */
.profile-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.profile-modal-overlay.show { display: flex; }

.profile-card {
    position: relative;
    background: linear-gradient(180deg, rgba(25, 25, 35, 0.95) 0%, rgba(15, 15, 22, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 360px;
    max-width: 95vw;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 20px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 100px -20px rgba(93, 173, 226, 0.15);
}

/* Abstract Art Background */
.profile-card-art {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 180px;
    overflow: hidden;
    opacity: 0.8;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
}
.profile-card-art-shape1 {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: var(--card-gradient, linear-gradient(135deg, #5DADE2, #764ba2));
    filter: blur(0px);
    transform: var(--card-transform, translate(-20%, -30%) rotate(0deg));
    animation: morphShape 20s ease-in-out infinite;
}
.profile-card-art-shape2 {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    background: var(--card-gradient-2, linear-gradient(135deg, #764ba2, #5DADE2));
    opacity: 0.7;
    filter: blur(20px);
    transform: var(--card-transform-2, translate(120%, -10%) rotate(45deg));
    animation: morphShape2 15s ease-in-out infinite;
}
@keyframes morphShape {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25% { border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%; }
    50% { border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%; }
    75% { border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%; }
}
@keyframes morphShape2 {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    33% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    66% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; }
}

.profile-card-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.75rem;
    z-index: 10;
}
.profile-card-close:hover {
    background: rgba(239, 68, 68, 0.6);
    color: white;
    transform: scale(1.05);
}

/* Banner / Nameplate - hidden by default */
.profile-card-banner {
    display: none;
    height: 90px;
    background-size: cover;
    background-position: center;
}
.profile-card-banner.has-nameplate {
    display: block;
}

/* Avatar Section - positioned to overlap art */
.profile-card-avatar-section {
    display: flex;
    justify-content: center;
    margin-top: 50px;
    position: relative;
    z-index: 5;
}
.profile-card.has-banner .profile-card-avatar-section {
    margin-top: -50px;
}
/* Container sized for decoration (larger than avatar) */
.profile-card-avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Avatar with premium ring */
.profile-card-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(15, 15, 22, 1);
    box-shadow:
        0 0 0 4px rgba(15, 15, 22, 1),
        0 8px 24px -4px rgba(0, 0, 0, 0.5);
}
.profile-card-avatar-fallback {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5DADE2, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    box-shadow:
        0 0 0 4px rgba(15, 15, 22, 1),
        0 8px 24px -4px rgba(0, 0, 0, 0.5);
}

/* Avatar Decoration - fills the container */
.profile-card-decoration {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    display: none;
}
.profile-card-decoration.show {
    display: block;
}
.profile-card-decoration img {
    width: 100%;
}

/* Status Dot */
.avatar-status-dot {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #747f8d;
    border: 4px solid rgba(15, 15, 22, 1);
    z-index: 5;
    transition: background 0.2s ease;
}
.avatar-status-dot.online {
    background: #23a55a;
    box-shadow: 0 0 8px rgba(35, 165, 90, 0.5);
}
.avatar-status-dot.idle {
    background: #f0b232;
    box-shadow: 0 0 8px rgba(240, 178, 50, 0.4);
}
.avatar-status-dot.dnd {
    background: #f23f43;
    box-shadow: 0 0 8px rgba(242, 63, 67, 0.4);
}
.avatar-status-dot.offline {
    background: #747f8d;
}
.avatar-status-dot.streaming {
    background: #764ba2;
    box-shadow: 0 0 8px rgba(118, 75, 162, 0.5);
}

/* Premium Ring — static brand gradient, no animation */
.profile-card-avatar-wrapper.premium-ring::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, #5DADE2, #764ba2);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 0;
}

/* Activity Section */
.profile-card-activity {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 24px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}
.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-light);
    flex-shrink: 0;
}
.activity-icon.playing { color: #23a55a; background: rgba(35, 165, 90, 0.1); }
.activity-icon.listening { color: #1db954; background: rgba(29, 185, 84, 0.1); }
.activity-icon.watching { color: #5865f2; background: rgba(88, 101, 242, 0.1); }
.activity-icon.streaming { color: #764ba2; background: rgba(118, 75, 162, 0.12); }
.activity-icon.competing { color: #f0b232; background: rgba(240, 178, 50, 0.1); }
.activity-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.activity-type {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.52);
    margin-bottom: 2px;
}
.activity-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-details {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.activity-details:empty { display: none;
    height: 100%;
    object-fit: contain;
}

/* User Info */
.profile-card-info {
    text-align: center;
    padding: 16px 24px 0;
}
.profile-card-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
    letter-spacing: -0.02em;
}
.profile-card-username {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

/* Meta line: member number + join date */
.profile-card-meta {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
    letter-spacing: 0.01em;
}
.profile-card-meta-sep {
    color: rgba(255, 255, 255, 0.2);
}
.profile-card-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: rgba(93, 173, 226, 0.1);
    border: 1px solid rgba(93, 173, 226, 0.2);
    border-radius: 999px;
}

/* Profile Badges */
.profile-card-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    padding: 0 12px;
}
.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.profile-badge i {
    font-size: 0.625rem;
}

/* Owner Badge — calm brand-gradient chip */
.owner-badge {
    background: linear-gradient(135deg, rgba(93, 173, 226, 0.16), rgba(118, 75, 162, 0.16));
    border: 1px solid rgba(93, 173, 226, 0.28);
    color: #cfe5f7;
}
.owner-badge i { color: #5DADE2; }

/* Tenure Badges - Refined */
.tenure-badge {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.tenure-badge.newbie {
    background: linear-gradient(135deg, rgba(116, 185, 255, 0.2), rgba(9, 132, 227, 0.2));
    border-color: rgba(116, 185, 255, 0.3);
    color: #74b9ff;
}
.tenure-badge.bronze {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(139, 69, 19, 0.2));
    border-color: rgba(205, 127, 50, 0.3);
    color: #cd7f32;
}
.tenure-badge.silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15), rgba(128, 128, 128, 0.15));
    border-color: rgba(192, 192, 192, 0.25);
    color: #c0c0c0;
}
.tenure-badge.gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(218, 165, 32, 0.15));
    border-color: rgba(255, 215, 0, 0.3);
    color: #ffd700;
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.15);
}
.tenure-badge.platinum {
    background: linear-gradient(135deg, rgba(229, 228, 226, 0.15), rgba(169, 169, 169, 0.1), rgba(229, 228, 226, 0.15));
    background-size: 200% 200%;
    animation: platinumShine 3s ease infinite;
    border-color: rgba(229, 228, 226, 0.3);
    color: #e5e4e2;
    box-shadow: 0 2px 12px rgba(229, 228, 226, 0.15);
}
@keyframes platinumShine {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.tenure-badge.diamond {
    background: linear-gradient(135deg, rgba(93, 173, 226, 0.18), rgba(118, 75, 162, 0.18), rgba(93, 173, 226, 0.18));
    background-size: 200% 200%;
    animation: diamondShine 3s ease infinite;
    border-color: rgba(93, 173, 226, 0.35);
    color: #5DADE2;
    box-shadow: 0 2px 12px rgba(93, 173, 226, 0.22);
}
@keyframes diamondShine {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Streak Badge — quiet by default, warmer at higher tiers */
.streak-badge {
    background: rgba(255, 107, 0, 0.10);
    border: 1px solid rgba(255, 107, 0, 0.22);
    color: #ff8a3d;
}
.streak-badge i { color: #ff8a3d; }
.streak-badge.hot {
    background: rgba(255, 69, 0, 0.14);
    border-color: rgba(255, 69, 0, 0.3);
}
.streak-badge.blazing {
    background: rgba(255, 165, 0, 0.14);
    border-color: rgba(255, 165, 0, 0.3);
    color: #ffa726;
}
.streak-badge.blazing i { color: #ffa726; }

/* Achievement Badges */
.profile-card-achievements {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    margin-top: 12px;
}
.profile-card-achievements:empty {
    display: none;
}
.achievement-badge {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    position: relative;
}
.achievement-badge:hover {
    background: rgba(255, 255, 255, 0.06);
}
/* Earned badges share a single neutral surface — color comes from the icon. */
.achievement-badge.earned {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.10);
    color: #5DADE2;
}
.achievement-badge.earned.rare    { color: #ffd166; }
.achievement-badge.earned.legendary { color: #f472b6; }

/* ── Site-styled hover tooltips (replaces native title="") ──────────── */
/* The status dot is already position:absolute, so it provides its own anchor
   and must not be forced to relative — everything else needs the context. */
.profile-card [data-tooltip]:not([data-tooltip=""]):not(.avatar-status-dot) { position: relative; }
.profile-card [data-tooltip]:not([data-tooltip=""])::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 5px 9px;
    background: rgba(18, 20, 26, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #e7eaf0;
    font-size: 0.6875rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 60;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
    transition: opacity 0.16s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.profile-card [data-tooltip]:not([data-tooltip=""])::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: rgba(18, 20, 26, 0.98);
    pointer-events: none;
    opacity: 0;
    z-index: 60;
    transition: opacity 0.16s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.profile-card [data-tooltip]:not([data-tooltip=""]):hover::after,
.profile-card [data-tooltip]:not([data-tooltip=""]):focus-visible::after,
.profile-card [data-tooltip]:not([data-tooltip=""]):hover::before,
.profile-card [data-tooltip]:not([data-tooltip=""]):focus-visible::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Owner card — subtle brand-tinted border, no animation */
.profile-card.owner-card {
    border-color: rgba(93, 173, 226, 0.22);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 20px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 60px -10px rgba(93, 173, 226, 0.18);
}

/* Platform Status */
.profile-card-platforms {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 24px 0;
    min-height: 0;
}
.profile-card-platforms:empty,
.profile-card-platforms:not(:has(.active)) {
    padding: 0;
    display: none;
}
.profile-card-platforms .platform-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.2s, background 0.2s;
}
.profile-card-platforms .platform-icon.active {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    color: #b3b3bb;
}

/* Stats Row */
.profile-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 18px 20px 22px;
    margin-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.profile-stat {
    text-align: center;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.025);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.2s, border-color 0.2s;
}
.profile-stat:hover {
    background: rgba(93, 173, 226, 0.06);
    border-color: rgba(93, 173, 226, 0.2);
}
.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.profile-stat-label {
    font-family: inherit;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.52);
    text-transform: none;
    letter-spacing: 0.01em;
    margin-top: 6px;
    font-weight: 700;
}

/* 3D Tilt Effect */
.profile-card {
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}
.profile-card.tilting {
    transition: none;
}

@media (max-width: 480px) {
    .profile-card {
        width: 100%;
    }
    .profile-card-avatar-wrapper {
        width: 110px;
        height: 110px;
    }
    .profile-card-avatar, .profile-card-avatar-fallback {
        width: 88px;
        height: 88px;
        font-size: 2rem;
    }
    .profile-card-stats {
        flex-wrap: wrap;
        gap: 6px;
        padding: 12px 16px 16px;
    }
    .profile-stat {
        flex: 1 1 calc(50% - 6px);
        min-width: calc(50% - 6px);
        padding: 10px 6px;
    }
    .profile-stat-value {
        font-size: 1.125rem;
    }
    .profile-card-avatar-section {
        margin-top: -45px;
    }
}

/* Modal styles */

.logout-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.logout-modal-overlay.show { display: flex; }

.logout-modal-content {
    background: #15151c;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-card);
    padding: 32px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.2s var(--ease-lift), opacity 0.2s var(--ease-lift);
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.55);
}
.logout-modal-overlay.show .logout-modal-content {
    transform: scale(1);
    opacity: 1;
}

.logout-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ef4444;
}

.logout-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
}

.logout-modal-text {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0 0 24px;
}

.logout-modal-actions {
    display: flex;
    gap: 12px;
}

.logout-btn-cancel {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.logout-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-light);
}

.logout-btn-confirm {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
}
.logout-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Modal styles */

.wallet-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.wallet-modal-overlay.show { display: flex; }

.wallet-modal-content {
    background: #15151c;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-card);
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.55);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.96) translateY(8px);
    opacity: 0;
    transition: transform 0.3s var(--ease-lift), opacity 0.3s var(--ease-lift);
}
.wallet-modal-overlay.show .wallet-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.wallet-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.wallet-modal-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    letter-spacing: -0.03em;
}

.wallet-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
}
.wallet-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.wallet-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.wallet-balance-card {
    text-align: center;
    padding: 32px 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 24px;
}
.wallet-balance-label {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.56);
    margin-bottom: 8px;
}
.wallet-balance-value {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #5DADE2, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -0.03em;
}
.wallet-section-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: #fff;
    letter-spacing: -0.02em;
}
.wallet-promo-section {
    margin-bottom: 24px;
}
.wallet-promo-row {
    display: flex;
    gap: 8px;
}
.wallet-promo-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    outline: none;
    transition: border-color 0.15s;
}
.wallet-promo-input:focus {
    border-color: var(--primary);
}
.wallet-promo-input::placeholder {
    color: var(--text-light);
    opacity: 0.5;
    font-weight: 400;
    letter-spacing: 0;
}
.wallet-promo-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.15s;
}
.wallet-promo-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(93, 173, 226, 0.3);
}
.wallet-promo-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.wallet-promo-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
}
.wallet-promo-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.wallet-promo-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Premium Trial Section */
.wallet-premium-section {
    margin-bottom: 24px;
}
.premium-trial-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.premium-trial-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}
.premium-trial-option:hover {
    border-color: var(--primary);
    background: rgba(93, 173, 226, 0.06);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 173, 226, 0.15);
}
.premium-trial-option.featured {
    border-color: rgba(93, 173, 226, 0.3);
    background: rgba(93, 173, 226, 0.05);
}
.premium-trial-option:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.premium-trial-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 10px;
    background: var(--premium-gradient);
    border-radius: 20px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1a1208;
    white-space: nowrap;
}
.premium-trial-duration {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
}
.premium-trial-cost {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
}
.premium-trial-status {
    text-align: center;
    padding: 14px;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 12px;
}
.premium-trial-status.active {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success);
}
.premium-trial-status.no-server {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-light);
}
