\documentclass[11pt,openany]{book}

\usepackage[
paperwidth=16.5cm,
paperheight=23.5cm,
left=1.95cm,
right=1.95cm,
top=2.2cm,
bottom=1.8cm,
headheight=15pt,
headsep=0.6cm,
includehead
]{geometry}

\usepackage{fancyhdr}
\usepackage{caption}
\captionsetup{font=footnotesize}

\usepackage{setspace}
\setstretch{1}

\usepackage[english]{babel}
\usepackage{polski}
\usepackage[utf8]{inputenc}

\usepackage{cite}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{titlesec}
\usepackage{amssymb}

% Solution: Prevents forcing equal page height
\raggedbottom



% Custom section numbering: 1., 1.1., 1.1.1.
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}
\renewcommand{\thesubsubsection}{\thesubsection\arabic{subsubsection}.}

% Add this after the above lines to center sections
\titleformat{\section}
{\normalfont\large\bfseries\centering}
{\thesection}
{1em}
{}

\titleformat{\subsection}
{\normalfont\normalsize\bfseries\centering}
{\thesubsection}
{1em}
{}

\titleformat{\subsubsection}
{\normalfont\small\bfseries\centering}
{\thesubsubsection}
{1em}
{}

% Adjust spacing if needed
\titlespacing*{\section}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

% Article metadata commands for multiple authors
\newcommand{\articletitle}[1]{\gdef\myarticletitle{\sc#1}}
\newcommand{\abstractcontent}[1]{\gdef\myabstract{#1}}

% Default values for metadata
\providecommand\myarticletitle{}
\providecommand\myabstract{}
\providecommand\myauthorone{}
\providecommand\myauthoremailone{}
\providecommand\myaffiliationone{}
\providecommand\myauthortwo{}
\providecommand\myauthoremailtwo{}
\providecommand\myaffiliationtwo{}
\providecommand\myauthorthree{}
\providecommand\myauthoremailthree{}
\providecommand\myaffiliationthree{}

\newcommand{\headerauthors}[1]{\gdef\myheaderauthors{#1}}
\providecommand\myheaderauthors{} % Default empty

% Store affiliation content in a box
\newsavebox{\affiliationbox}
\newcommand{\makeaffiliation}[1]{%
	\global\setbox\affiliationbox=\vbox{%
		\hbox{\hspace*{-\parindent}%
			\begin{minipage}{\textwidth}
				\setlength{\parindent}{0pt}%
				\setlength{\leftskip}{0pt}%
				#1%
		\end{minipage}}%
	}%
}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{\centering\myheaderauthors}
\renewcommand{\headrulewidth}{0.4pt}
\fancyfoot[C]{\thepage}

\usepackage{etoolbox}

% First page style (no header/footer)
\fancypagestyle{plain}{
	\fancyhf{}
	\renewcommand{\headrulewidth}{0pt}
}

% Center chapter number and title
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries\centering}
{\filcenter\chaptername\ \thechapter}
{20pt}
{\LARGE\filcenter}
\titlespacing*{\chapter}{0pt}{50pt}{40pt}

\newcommand{\displayedauthors}[1]{\gdef\mydisplayedauthors{#1}}
\providecommand\mydisplayedauthors{} % Default empty

% Chapter title command with abstract
\makeatletter
\newcommand{\makemychapter}{%
	\cleardoublepage%
	\thispagestyle{plain}%
	\vspace*{50pt}%
	\begin{center}
		\Large\bfseries\chaptername\ \thechapter\\[20pt]
		\LARGE\myarticletitle
	\end{center}
	\vspace{30pt}
	% Display manually defined authors
	\begin{center}
		\normalsize
		\mydisplayedauthors
	\end{center}
	\vspace{20pt}
	\textbf{Abstract.} \myabstract
	\vspace{20pt}
}
\makeatother

% Mathematical environments - unified numbering
\newtheoremstyle{mystyle}
{\topsep}
{\topsep}
{\itshape}
{}
{\bfseries}
{.}
{.5em}
{}

\theoremstyle{mystyle}

\newtheorem{maincounter}{}
\renewcommand{\themaincounter}{\arabic{maincounter}}

\newtheorem{definition}[maincounter]{Definition}
\newtheorem{theorem}[maincounter]{Theorem}
\newtheorem{corollary}[maincounter]{Corollary}
\newtheorem{lemma}[maincounter]{Lemma}
\newtheorem{proposition}[maincounter]{Proposition}
\newtheorem{conjecture}[maincounter]{Conjecture}
\newtheorem{assumption}[maincounter]{Assumption}
\newtheorem{remark}[maincounter]{Remark}
\newtheorem{notation}[maincounter]{Notation}
\newtheorem{problem}[maincounter]{Problem}


\renewcommand{\theequation}{\arabic{equation}}


% Bibliography environment modification
\makeatletter
\renewenvironment{thebibliography}[1]{%
	\section*{\refname}%
	\list{\@biblabel{\@arabic\c@enumiv}}%
	{\settowidth\labelwidth{\@biblabel{#1}}%
		\leftmargin\labelwidth
		\advance\leftmargin\labelsep
		\@openbib@code
		\usecounter{enumiv}%
		\let\p@enumiv\@empty
		\renewcommand\theenumiv{\@arabic\c@enumiv}}%
	\sloppy
	\clubpenalty 4000
	\@clubpenalty \clubpenalty
	\widowpenalty 4000%
	\interlinepenalty 4000
	\sfcode`\.\@m
}{%
	\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
	\endlist
	% Display affiliations after bibliography
	\ifvoid\affiliationbox\else
	\par
	\vspace{2em}
	\begin{center}
		\textbf{Affiliations:} \\
		\vspace{1em}
		\begin{minipage}{0.8\textwidth}
			\unvbox\affiliationbox
		\end{minipage}
	\end{center}
	\fi
}
\makeatother

	% CHAPTER 
\setcounter{chapter}{1}

\begin{document}
	

	
	\articletitle{Title}
	
	\abstractcontent{Abstract.}
	
	% Command to define authors displayed on the title page (first page)
	\displayedauthors{Author 1, Author 2}
	
	% Command to define authors displayed in the page header
	\headerauthors{Author 1, Author 2}
	
	% Affiliation information can be placed anywhere in the document
	\makeaffiliation{
		\noindent
		\textbf{Author 1}\\ 
		(Department Name), (Faculty or College Name)\\
		(University Name),(City) (Postal Code), (Country)\\
		\textbf{E-mail}: \texttt{email@university.edu}\\
		
		\vspace{0.5em}
		
		\noindent
		\textbf{Author 2}\\
		(Department Name), (Faculty or College Name)\\
		(University Name),(City) (Postal Code), (Country)\\
		\textbf{E-mail}: \texttt{email@university.edu}\\
		
%		\vspace{0.5em}
%		
%		\noindent
%		\textbf{Author 3}\\
%		(Department Name), (Faculty or College Name)\\
%		(University Name),(City) (Postal Code), (Country)\\
%		\textbf{E-mail}: \texttt{email@university.edu}\\
		
	}
	
	\makemychapter
	
	\section{Section}
	
	\begin{definition}
		Definition.
	\end{definition}
	
	\begin{theorem}
		Theorem.
		\begin{equation}
			Equation.
		\end{equation}
	\end{theorem}
	
	\begin{corollary}
		Corollary.
	\end{corollary}
	
	\begin{lemma}
		Lemma.
	\end{lemma}
	
	\begin{proposition}
		Proposition.
	\end{proposition}
	
	\begin{conjecture}
		Conjecture.
	\end{conjecture}
	
	\begin{assumption}
		Assumption.
	\end{assumption}
	
	\begin{remark}
		Remark.
	\end{remark}
	
	\begin{notation}
		Notation.
	\end{notation}
	
	\begin{problem}
		Problem.
	\end{problem}
	
	
	\section{Section}
	
	\begin{remark}
		Remark.
	\end{remark}
	
	\begin{lemma}
		Lemma.
	\end{lemma}
	
	\section{Section}
	
	\begin{theorem}
		Theorem.
	\end{theorem}
	
	\begin{proof}
		Proof.
	\end{proof}
	
	%Examples (styles):
	%
	%\bibitem{Be} D. Beck, {\em Introduction to Dynamical System}, Progr. Math. 54, Birkhäuser, Basel, 1978. %<-- the pattern for books
	%
	%\bibitem{Hi} R. Hill, A. James, \textit{A new index formula}, J. Geometry 15 (1982) 19--31. %<-- the pattern for articles
	%
	%\bibitem{Ko} J. Kowalski, {\em Some remarks on J(X)},in: Algebra and Analysis (Edmonton, 1973), E. Brook (ed.), Lecture Notes in Math. 867, Springer, Berlin, 1974, 115-124. %<-- the pattern for chapter in a monograph
	
	\begin{thebibliography}{9}
		
	\end{thebibliography}
	
	
	
\end{document}
