:root {
    --maxWidth: 450px;
	--backgroundColor: #1E1F22;
    --firstColor: #2C2F33;
    --secondColor: #4654C0;
	--thirdColor: #7AB7FF;
	--animationDuration: 0.3s;
	--headerHeight: 80px;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    box-sizing: border-box;
}

html,
body {
    font-family: Arial, sans-serif;
    font-size: 18px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
	height: 100%;
    background: var(--backgroundColor) url("images/background.webp") no-repeat center/cover;
	color: white;
    user-select: none;
	-webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: var(--maxWidth);
    width: 100%;
    margin: 0 auto;
}

img {
    display: block;
    max-width: 100%;
}

button {
	all: unset;
	display: inline-block;
	cursor: pointer;
	width: 200px;
	padding: 10px 20px;
	margin: 0 auto;
	border-radius: 15px;
	text-align: center;
    background-color: var(--firstColor);
    transition: all var(--animationDuration) ease;
}

button:hover {
    background-color: var(--secondColor);
    transform: scale(1.05);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.header,
.main {
	max-width: var(--maxWidth);
    width: 100%;
    margin: 0 auto;
    box-shadow: -5px 0 10px rgba(37,39,42,0.5), 5px 0 10px rgba(37,39,42,0.5);
}

.header {
	height: var(--headerHeight);
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--firstColor);
    display: flex;
    align-items: center;
    padding: 10px 50px;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--thirdColor), var(--secondColor));
}

.avatar-img {
    width: 100%;
    height: 100%;
    background: url('images/avatar.webp') center/cover no-repeat;
    pointer-events: none;
}

.avatar::after {
    content: '';
    position: absolute;
    inset: 0;
}

.user-info .username {
    font-size: 1rem;
    font-weight: bold;
}

.user-info .status {
    font-size: 0.9rem;
    color: var(--thirdColor);
}

.main {
    flex: 1;
    display: flex;
	position: relative;
}

.main .container {
    padding: calc(var(--headerHeight) + 10px) 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
	background-color: var(--backgroundColor);
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    position: relative;
    max-width: 70%;
    display: inline-block;
    padding: 10px 20px;
    margin: 10px 0;
    font-size: 1rem;
    opacity: 0;
    animation: fadeIn var(--animationDuration) forwards;
	border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.message-to {
    background-color: var(--firstColor);
    align-self: flex-start;
    margin-left: 11px;
    border-bottom-left-radius: 0;
	border-bottom-right-radius: 15px;
}

.message-from {
    background-color: var(--secondColor);
    align-self: flex-end;
    margin-right: 11px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 0;
}

.message-to::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 18px;
    bottom: 0;
    left: -10px;
    background: url("images/message-tail-to.webp") no-repeat;
    background-size: contain;
}

.message-from::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 18px;
    bottom: 0;
    right: -10px;
    background: url("images/message-tail-from.webp") no-repeat;
    background-size: contain;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    animation: fadeIn var(--animationDuration) forwards;
}

.choice-id {
	font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", "Source Code Pro", "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
	color: #797979;
	margin: 0 auto;
}

#start-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    font-size: 1.5rem;
	transition: opacity 0.5s ease, transform 0.2s ease;
}

#start-button:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

#start-button:active {
    transform: translate(-50%, -50%) scale(0.98);
}

#start-button.fade-out {
    opacity: 0;
}

#titles {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    padding: 0 50px 50px;
	background: url("images/final.webp") no-repeat center top / cover;
    display: none;
    opacity: 0;
    font-size: 22px;
    text-align: center;
    justify-content: flex-end;
    align-items: center;
    flex-direction: column;
    gap: 20px;
    z-index: 1000;
}

#titles p {
    text-shadow: 3px 3px 6px rgba(0,0,0,0.9), 0 0 10px rgba(0,0,0,0.5);
}

#titles button {
	box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

#chat, .header, #titles {
    transition: all var(--animationDuration) ease;
}

#preloader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background:var(--firstColor);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 18px;
	z-index: 10000;
	transition: all var(--animationDuration) ease;
}

#preloader.hidden {
	opacity: 0;
	pointer-events: none;
}

#preloader .spinner {
	width: 50px;
	height: 50px;
	border: 5px solid rgba(255,255,255,0.3);
	border-top: 5px solid #fff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin-bottom: 15px;
}

@keyframes spin {
	to {
		transform: rotate(360deg); 
	}
}
