.profile-container {
    max-width: 1120px;
    margin: 0 auto;
}

.profile-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
    gap: 20px;
    align-items: start;
}

.profile-primary,
.profile-rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-section,
.profile-hero {
    background:
        linear-gradient(180deg, rgba(37, 40, 48, 0.96), rgba(24, 26, 28, 0.98)),
        #1e2024;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

.profile-banner {
    height: 180px;
    position: relative;
    overflow: hidden;
}

.banner-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(24, 26, 28, 0.05) 0%, rgba(24, 26, 28, 0.86) 100%);
}

.banner-noise {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background-image:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 20%),
        linear-gradient(45deg, transparent 55%, rgba(255, 255, 255, 0.1) 100%);
}

.profile-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    padding: 0 28px 28px;
    margin-top: -54px;
    position: relative;
    z-index: 1;
}

.profile-avatar-wrap {
    position: relative;
}

.profile-avatar {
    width: 112px;
    height: 112px;
    border-radius: 20px;
    object-fit: cover;
    background: #141517;
    border: 4px solid rgba(24, 26, 28, 0.9);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

.profile-info {
    min-width: 0;
}

.profile-identity {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-name {
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    line-height: 1.05;
    font-weight: 800;
    color: #fff8dc;
    letter-spacing: -0.03em;
}

.profile-role-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.role-badge-profile {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    padding: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.role-badge-profile svg {
    width: 18px;
    height: 18px;
}

.role-badge-profile.owner {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.34), rgba(245, 158, 11, 0.12));
    color: #ffd978;
    box-shadow:
        inset 0 0 0 1px rgba(255, 230, 160, 0.18),
        0 0 18px rgba(251, 191, 36, 0.18);
}

.role-badge-profile.admin {
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
}

.role-badge-profile.yt {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.role-badge-profile.xp-event {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
}

.profile-username {
    margin: 0;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.98rem;
}

.profile-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 18px 0 14px;
}

.profile-highlight-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.profile-highlight-streak {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.09), rgba(255, 255, 255, 0.02));
    border-color: rgba(251, 191, 36, 0.16);
}

.profile-highlight-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(24, 26, 28, 0.46);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-highlight-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.45));
}

.profile-highlight-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-highlight-value {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.profile-highlight-label {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.profile-bio {
    margin: 0 0 16px;
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.7;
    font-size: 0.98rem;
    white-space: pre-wrap;
    max-width: 58ch;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-joined,
.profile-likes-given,
.profile-mode {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.profile-joined,
.profile-likes-given {
    color: rgba(255, 255, 255, 0.68);
}

.profile-joined svg,
.profile-likes-given svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.profile-mode {
    color: #f8d36d;
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.2);
}

.profile-mode img {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: cover;
}

.profile-actions {
    display: flex;
    gap: 10px;
    align-self: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.profile-edit-btn,
.profile-follow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
    text-decoration: none;
}

.profile-edit-btn svg,
.profile-follow-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.profile-edit-btn:hover,
.profile-follow-btn:hover {
    transform: translateY(-1px);
}

.profile-edit-btn-primary,
.profile-follow-btn {
    border: none;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #181a1c;
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.22);
}

.profile-edit-btn-primary:hover,
.profile-follow-btn:hover {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
}

.profile-edit-btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.88);
}

.profile-edit-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

.profile-follow-btn .following-icon {
    display: none;
}

.profile-follow-btn.following {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.26);
    color: #fbbf24;
    box-shadow: none;
}

.profile-follow-btn.following .follow-icon {
    display: none;
}

.profile-follow-btn.following .following-icon {
    display: block;
}

.profile-follow-btn.following:hover {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.26);
    color: #f87171;
}

.profile-logout-panel {
    border: 1px solid rgba(248, 113, 113, 0.15);
}

.profile-logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.profile-logout-link:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.profile-logout-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
}

.profile-stats {
    padding: 18px 22px;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: visible;
}

.stat-icon {
    width: 20px;
    height: 20px;
    stroke: rgba(251, 191, 36, 0.7);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.stat-item.clickable {
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.stat-item.clickable:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(251, 191, 36, 0.16);
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    color: #fff4bf;
}

.stat-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(255, 255, 255, 0.5);
}

.profile-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 0;
}

.profile-section-kicker {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.46);
}

.profile-section-title,
.profile-panel-title {
    margin: 0;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 750;
}

.profile-content {
    padding: 18px 16px 16px;
}

.profile-tabs {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.profile-tab svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.profile-tab strong {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.82rem;
}

.profile-tab:hover {
    transform: translateY(-1px);
    color: rgba(255, 255, 255, 0.86);
    border-color: rgba(255, 255, 255, 0.12);
}

.profile-tab.active {
    color: #181a1c;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: transparent;
}

.profile-tab.active strong {
    color: #181a1c;
}

.tab-content {
    display: block;
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.posts-empty {
    text-align: center;
    padding: 56px 22px;
    color: rgba(255, 255, 255, 0.48);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.posts-empty svg {
    width: 40px;
    height: 40px;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1.5;
    fill: none;
    margin-bottom: 12px;
}

.posts-empty p {
    margin: 0;
    font-size: 0.95rem;
}

.profile-panel {
    padding: 20px;
}

.profile-panel-copy {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.68);
    line-height: 1.6;
    font-size: 0.95rem;
}

.profile-customize-panel {
    background:
        radial-gradient(circle at top right, rgba(251, 191, 36, 0.15), transparent 42%),
        linear-gradient(180deg, rgba(37, 40, 48, 0.96), rgba(24, 26, 28, 0.98)),
        #1e2024;
}

.profile-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.profile-quick-action {
    display: block;
    padding: 14px 16px;
    border-radius: 10px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.profile-quick-action:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(251, 191, 36, 0.22);
}

.profile-quick-action span {
    display: block;
    color: #fff;
    font-weight: 700;
}

.profile-quick-action small {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.82rem;
}

.profile-detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.profile-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-detail-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.92rem;
}

.profile-detail-label svg {
    width: 16px;
    height: 16px;
    stroke: rgba(251, 191, 36, 0.6);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.profile-detail-label svg[fill="currentColor"] {
    fill: rgba(251, 191, 36, 0.6);
    stroke: none;
}

.profile-detail-row span {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.92rem;
}

.profile-detail-row strong {
    color: #fff;
    font-size: 0.95rem;
}

.badges-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    font-weight: 700;
}

.badges-title svg {
    width: 16px;
    height: 16px;
    color: #fbbf24;
}

.badges-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    cursor: default;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.badge-item:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.badge-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-icon svg {
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 0 4px currentColor);
}

.badge-name {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.83rem;
    font-weight: 700;
}

@media (max-width: 980px) {
    .profile-shell {
        grid-template-columns: 1fr;
    }

    .profile-rail {
        order: 2;
    }
}

@media (max-width: 720px) {
    .profile-container {
        max-width: 100%;
    }

    .profile-shell {
        gap: 14px;
    }

    .profile-section,
    .profile-hero {
        border-radius: 14px;
    }

    .profile-banner {
        height: 144px;
    }

    .profile-header {
        grid-template-columns: 1fr;
        margin-top: -44px;
        padding: 0 18px 20px;
        gap: 14px;
        text-align: center;
    }

    .profile-avatar-wrap {
        justify-self: center;
    }

    .profile-avatar {
        width: 96px;
        height: 96px;
        border-radius: 16px;
    }

    .profile-name-row,
    .profile-meta,
    .profile-actions {
        justify-content: center;
    }

    .profile-role-group {
        justify-content: center;
    }

    .profile-bio {
        margin-left: auto;
        margin-right: auto;
    }

    .profile-highlights {
        justify-content: center;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-content-header {
        flex-direction: column;
        align-items: stretch;
        padding: 18px 18px 0;
    }

    .profile-content {
        padding: 14px;
    }

    .profile-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .profile-tab {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .profile-banner {
        height: 128px;
    }

    .profile-meta {
        gap: 8px;
    }

    .profile-highlights {
        flex-direction: column;
    }

    .profile-highlight-card {
        width: 100%;
    }

    .profile-joined,
    .profile-likes-given,
    .profile-mode {
        width: 100%;
        justify-content: center;
    }

    .profile-edit-btn,
    .profile-follow-btn {
        width: 100%;
    }

    .profile-actions {
        width: 100%;
    }

    .profile-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-item {
        padding: 14px;
    }
}
