/* SITE CHAT
----------------------------------------------- */
.site-chat {
	--chat-w: 340px;
	--chat-toggle-w: 36px;
	position: fixed;
	right: 0;
	top: var(--header-h, 50px);
	bottom: 0;
	z-index: 850;
	pointer-events: none;
	font-size: 13px;
	}
.site-chat__toggle {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: var(--chat-toggle-w);
	min-height: 150px;
	padding: 12px 0;
	border: 0;
	border-radius: 10px 0 0 10px;
	background: var(--bg-black);
	border: 1px solid rgba(255,255,255,0.08);
	border-right: 0;
	color: var(--accent);
	font-size: 16px;
	cursor: pointer;
	pointer-events: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	box-shadow: -4px 0 20px rgba(0,0,0,0.25);
	transition: background-color 0.2s, color 0.2s, right 0.3s;
	}
.site-chat__fab {
	display: none !important;
	position: fixed;
	right: 16px;
	bottom: calc(68px + env(safe-area-inset-bottom, 0));
	z-index: 920;
	width: 52px;
	height: 52px;
	border: 0;
	border-radius: 50%;
	background: var(--accent);
	color: var(--bg-black);
	font-size: 22px;
	cursor: pointer;
	pointer-events: auto;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(0,0,0,0.35);
	transition: transform 0.2s, filter 0.2s;
	}
.site-chat__fab-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--ui-red, #e74c3c);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	border: 2px solid var(--bg-black);
	}
.site-chat__toggle-label {
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--accent);
	}
.site-chat__badge {
	position: absolute;
	top: 20px;
	left: 10px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: var(--ui-red, #e74c3c);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	}
.site-chat__panel {
	position: absolute;
	right: calc(-1 * var(--chat-w));
	top: 0;
	bottom: 0;
	width: var(--chat-w);
	background: var(--bg-black);
	display: flex;
	flex-direction: column;
	pointer-events: auto;
	transition: right 0.3s ease, width 0.3s ease;
	}
.site-chat__content {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	width: 100%;
	}
.site-chat.is-open .site-chat__panel {right: 0;}
.site-chat.is-open .site-chat__toggle {right: var(--chat-w);}
.site-chat.is-expanded {
	left: 0;
	right: 0;
	z-index: 900;
	}
.site-chat.is-expanded .site-chat__panel {
	width: 100%;
	right: 0;
	}
.site-chat.is-expanded.is-open .site-chat__toggle {display: none;}
.site-chat.is-expanded .site-chat__header,
.site-chat.is-expanded .site-chat__content {
	max-width: 900px;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
	}
.site-chat.is-expanded .site-chat__header {
	box-sizing: border-box;
	padding-left: 16px;
	padding-right: 16px;
	}

.site-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid rgba(255,255,255,0.06);
	flex-shrink: 0;
	}
.site-chat__header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	position: relative;
	}
.site-chat__settings {
	position: relative;
	}
.site-chat__expand-btn,
.site-chat__settings-btn {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: var(--bg-darker);
	color: var(--tt-fade);
	font-size: 14px;
	cursor: pointer;
	}
.site-chat__expand-btn:hover,
.site-chat__expand-btn.is-active {
	color: var(--accent);
	}
.site-chat__settings-btn:hover,
.site-chat__settings-btn.is-open {
	color: var(--accent);
	}
.site-chat__settings-menu {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 240px;
	padding: 6px;
	border-radius: 10px;
	background: var(--bg-black);
	border: 1px solid rgba(255,255,255,0.1);
	box-shadow: 0 12px 32px rgba(0,0,0,0.45);
	z-index: 3;
	}
.site-chat__settings-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--tt);
	text-align: left;
	text-decoration: none;
	font-size: 13px;
	cursor: pointer;
	}
.site-chat__settings-item:hover {
	background: rgba(255,255,255,0.06);
	color: var(--accent);
	}
.site-chat__settings-item.is-muted {
	color: var(--tt-fade);
	}
.site-chat__settings-item-icon {
	flex: 0 0 auto;
	width: 16px;
	text-align: center;
	font-size: 14px;
	}
.site-chat__settings-link {
	display: flex;
	}
.site-chat__settings-divider {
	height: 1px;
	margin: 4px 6px;
	background: rgba(255,255,255,0.08);
	}
.site-chat__settings-item--danger {
	color: #ff8a80;
	}
.site-chat__settings-item--danger:hover {
	color: #ffab91;
	}
.site-chat__title {
	font-weight: 600;
	font-size: 15px;
	color: var(--tt);
	display: flex;
	align-items: center;
	gap: 8px;
	}
.site-chat__title::before {color: var(--accent);}
.site-chat__close {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: var(--bg-darker);
	color: var(--tt-fade);
	font-size: 14px;
	cursor: pointer;
	}

.site-chat__rooms {
	display: flex;
	gap: 6px;
	padding: 10px 12px;
	border-bottom: 1px solid rgba(255,255,255,0.06);
	overflow-x: auto;
	flex-shrink: 0;
	scrollbar-width: none;
	}
.site-chat__rooms::-webkit-scrollbar {display: none;}
.site-chat__room {
	flex: 0 0 auto;
	position: relative;
	padding: 6px 10px;
	border: 0;
	border-radius: 10px;
	background: var(--bg-darker);
	color: var(--tt-fade);
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.2s, color 0.2s;
	}
.site-chat__room-label {
	display: inline-block;
	}
.site-chat__room-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	min-width: 20px;
	height: 20px;
	padding: 0 4px;
	border-radius: 20px;
	background: #eb4d4b;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	font-size: 10px;
	text-align: center;
	border: 2px solid var(--bg-black);
	pointer-events: none;
	z-index: 1;
	}
.site-chat__room.is-active,
.site-chat__room:hover {
	background: var(--bg);
	color: var(--tt);
	}

.site-chat__online {
	padding: 8px 12px 10px;
	border-bottom: 1px solid rgba(255,255,255,0.06);
	flex-shrink: 0;
	}
.site-chat__online[hidden] {display: none !important;}
.site-chat__online-title {
	font-size: 11px;
	color: var(--tt-fade);
	margin-bottom: 6px;
	}
.site-chat__online-title span {color: var(--accent); font-weight: 600;}
.site-chat__online-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	max-height: 56px;
	overflow-y: auto;
	scrollbar-width: thin;
	}
.site-chat__online-user {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 8px;
	border-radius: 4px;
	background: var(--bg);
	color: var(--tt-fade-0);
	font-size: 11px;
	line-height: 1.2;
	max-width: 100%;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	}
.site-chat__online-user::before {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--online-dot, var(--accent));
	flex-shrink: 0;
	}
.site-chat__online-user.is-me {
	color: var(--tt);
	}

.site-chat__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	position: relative;
	}
.site-chat__guest {
	padding: 10px 12px;
	font-size: 12px;
	line-height: 1.45;
	color: var(--tt-fade);
	background: rgba(178, 222, 67, 0.08);
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	flex-shrink: 0;
	}
.site-chat__guest a {color: var(--accent);}
.site-chat__guest[hidden] {display: none !important;}
.site-chat__empty {
	padding: 24px 16px;
	text-align: center;
	font-size: 13px;
	line-height: 1.5;
	color: var(--tt-fade);
	}

.site-chat__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.06);
	}
.site-chat__status {
	padding: 10px 16px;
	font-size: 12px;
	text-align: center;
	flex-shrink: 0;
	}
.site-chat__status--muted {background: rgba(241,196,15,0.12); color: #f1c40f;}
.site-chat__status--banned {background: rgba(231,76,60,0.12); color: #e74c3c;}

.site-chat__msg {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 8px;
	max-width: 96%;
	position: relative;
	}
.site-chat__msg.is-own {
	align-self: flex-end;
	flex-direction: row-reverse;
	}
.site-chat__msg.is-other {align-self: flex-start;}
.site-chat__msg-avatar {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	border: 1px solid var(--bdc, rgba(255, 255, 255, 0.1));
	background: var(--bg-darker);
	cursor: pointer;
	}
.site-chat__msg-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	}
.site-chat__msg-avatar:hover {
	border-color: var(--accent);
	}
.site-chat__msg-main {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	flex: 1;
	}
.site-chat__msg.is-own .site-chat__msg-main {align-items: flex-end;}
.site-chat__msg.is-other .site-chat__msg-main {align-items: flex-start;}
.site-chat__msg-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 11px;
	color: var(--tt-fade);
	}
.site-chat__msg-name {
	font-weight: 600;
	color: var(--tt-fade-0);
	text-decoration: none;
	}
.site-chat__msg-name:hover {color: var(--accent);}
.site-chat__msg-time {opacity: 0.85;}
.site-chat__msg-reply-link {
	border: 0;
	padding: 0;
	background: none;
	color: var(--accent);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	height: auto;
	}
.site-chat__msg-reply-link:hover {}
.site-chat__msg.is-highlighted .site-chat__msg-main {
	animation: site-chat-msg-highlight 2.2s ease;
	}
@keyframes site-chat-msg-highlight {
	0%, 100% {box-shadow: none;}
	18% {box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 190, 255, 0), 0.55);}
	}
.site-chat__msg-group {
	padding: 1px 6px;
	border-radius: 4px;
	font-size: 9px;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 1.3;
	}
.site-chat__msg-bubble {
	padding: 8px 12px;
	border-radius: 12px;
	line-height: 1.45;
	word-break: break-word;
	background: var(--chat-bubble-bg, #2a2a2e);
	color: var(--chat-bubble-color, #eee);
	}
.site-chat__msg.is-own .site-chat__msg-bubble {border-bottom-right-radius: 4px;}
.site-chat__msg.is-other .site-chat__msg-bubble {border-bottom-left-radius: 4px;}
.site-chat__msg-reply {
	font-size: 11px;
	opacity: 0.75;
	border-left: 2px solid var(--accent);
	padding-left: 8px;
	margin-bottom: 4px;
	}
.site-chat__msg-image {
	display: block;
	max-width: 100%;
	border-radius: 8px;
	margin-top: 4px;
	cursor: pointer;
	}
.site-chat__msg-sticker {font-size: 36px; line-height: 1; padding: 4px 0;}
.site-chat__msg-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	margin-top: 4px;
	min-height: 15px;
	}
.site-chat__msg-actions:empty {
	display: none;
	min-height: 0;
	margin-top: 0;
	}
.site-chat__msg-action {
	border: 0;
	background: none;
	color: var(--tt-fade);
	font-size: 11px;
	cursor: pointer;
	padding: 2px 4px;
	height: auto;
	}
.site-chat__msg-action:hover {color: var(--tt);}
.chat-mention {color: var(--ui-accent); font-weight: 600;}

.site-chat__reply,
.site-chat__stickers {display: none !important;}

.site-chat__form {
	padding: 10px 12px;
	border-top: 1px solid rgba(255,255,255,0.06);
	flex-shrink: 0;
	background: var(--bg-black);
	}
.site-chat__form[hidden] {display: none !important;}
.site-chat__messages[hidden] {display: none !important;}
.site-chat__compose {
	display: flex;
	align-items: flex-end;
	width: 100%;
	gap: 2px;
	padding: 4px;
	border: 1px solid rgb(41 41 41);
	border-radius: 12px;
	background: #222222;
	transition: border-color 0.2s, box-shadow 0.2s;
	}
.site-chat__compose:focus-within {
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 190, 255, 0), 0.12);
	}
.site-chat__emoji-picker {
	margin-bottom: 8px;
	padding: 8px;
	border: 1px solid rgb(41 41 41);
	border-radius: 12px;
	background: #1a1a1a;
	overflow: hidden;
	}
.site-chat__emoji-picker[hidden] {display: none !important;}
.site-chat__emoji-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 4px;
	max-height: 220px;
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	}
.site-chat__emoji-grid::-webkit-scrollbar {width: 6px; height: 0;}
.site-chat__emoji-item {
	min-width: 0;
	width: 100%;
	aspect-ratio: 1;
	border: 0;
	border-radius: 8px;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	transition: background-color 0.15s;
	}
.site-chat__emoji-item:hover {background: rgba(255,255,255,0.08);}
.site-chat__emoji-btn {
	font-size: 20px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	}
.site-chat__emoji-btn.is-active {
	background: rgba(255,255,255,0.08);
	color: var(--tt);
	}
.site-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 36px;
	max-height: 120px;
	height: 36px;
	padding: 8px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--tt);
	font-size: 13px;
	line-height: 1.35;
	font-family: inherit;
	resize: none;
	overflow-y: auto;
	box-sizing: border-box;
	scrollbar-width: none;
	}
.site-chat__input:focus {outline: none;}
.site-chat__compose-btn {
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--tt-fade);
	font-size: 15px;
	cursor: pointer;
	display: grid;
	place-items: center;
	transition: background-color 0.2s, color 0.2s;
	}
.site-chat__attach {cursor: pointer; margin: 0;}
.site-chat__attach input {display: none;}
.site-chat__compose-btn--send {
	background: var(--bg);
	color: var(--tt);
	}
body.chat-is-open .wrapper__container--main {
	margin-right: var(--chat-w);
	transition: margin-right 0.3s ease;
	}
body.chat-is-open.chat-expanded .wrapper__container--main {
	margin-right: 0;
	}
body.chat-is-open .site-chat {pointer-events: auto;}

@media screen and (max-width: 1219px) {
	.site-chat {
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		height: auto;
		z-index: 1000;
		}
	.site-chat__toggle {display: none;}
	.site-chat__fab {
		display: flex;
		}
	.site-chat.is-open .site-chat__fab {display: none;}
	.site-chat__panel {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		right: auto;
		bottom: auto;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		transform: translateY(100%);
		transition: transform 0.3s ease;
		pointer-events: none;
		}
	.site-chat.is-open .site-chat__panel {
		transform: translateY(0);
		pointer-events: auto;
		}
	.site-chat__header {
		padding-top: calc(14px + env(safe-area-inset-top, 0));
		}
	.site-chat__form {
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
		}
	.site-chat__online-list {max-height: 72px;}
	.site-chat__msg-actions {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		}
	body.chat-is-open {
		overflow: hidden;
		touch-action: none;
		}
	body.chat-is-open .wrapper__container--main {margin-right: 0;}
	.mobile-rail__item--chat {position: relative;}
	.site-chat__mobile-badge {
		position: absolute;
		top: 2px;
		left: 50%;
		margin-left: 6px;
		min-width: 16px;
		height: 16px;
		padding: 0 4px;
		border-radius: 8px;
		background: var(--ui-red, #e74c3c);
		color: #fff;
		font-size: 10px;
		font-weight: 700;
		line-height: 16px;
		text-align: center;
		pointer-events: none;
		}
	.mobile-rail__item--chat.is-active {color: var(--accent);}
	}

.site-chat__expand-btn {display: none; place-items: center;}
@media screen and (min-width: 1220px) {
	.site-chat.is-open .site-chat__expand-btn {display: grid;}
	.site-chat__msg-actions:not(:empty) {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: opacity 0.15s ease, visibility 0.15s ease;
		}
	.site-chat__msg:hover .site-chat__msg-actions,
	.site-chat__msg:focus-within .site-chat__msg-actions {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		}
	.site-chat__toggle:hover {background: var(--bg-darker); color: var(--accent);}
	.site-chat__close:hover {color: var(--accent);}
	.site-chat__attach:hover,
	.site-chat__emoji-btn:hover {color: var(--accent);}
	.site-chat__compose-btn--send:hover {filter: brightness(1.08);color: var(--accent);}
	}

.site-chat-lightbox {
	position: fixed;
	inset: 0;
	z-index: 1400;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px 56px;
	}
.site-chat-lightbox[hidden] {display: none !important;}
.site-chat-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.88);
	cursor: zoom-out;
	}
.site-chat-lightbox__img {
	position: relative;
	z-index: 1;
	max-width: min(96vw, 1200px);
	max-height: 86vh;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 12px 48px rgba(0,0,0,0.5);
	user-select: none;
	}
.site-chat-lightbox__close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 12px;
	background: rgba(30,30,30,0.9);
	color: var(--tt);
	font-size: 18px;
	cursor: pointer;
	}
.site-chat-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(30,30,30,0.85);
	color: var(--tt);
	font-size: 18px;
	cursor: pointer;
	}
.site-chat-lightbox__nav--prev {left: 12px;}
.site-chat-lightbox__nav--next {right: 12px;}
body.site-chat-lightbox-open {overflow: hidden;}

.site-chat-toasts {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 1450;
	}
.site-chat-toasts .profile-toast {
	padding: 12px 16px;
	border-radius: 10px;
	background: var(--bg-black);
	border: 1px solid var(--bdc, rgba(255, 255, 255, 0.1));
	color: var(--tt);
	font-size: 13px;
	line-height: 1.4;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: auto;
	}
.site-chat-toasts .profile-toast.is-visible {
	opacity: 1;
	transform: translateY(0);
	}
.site-chat-toasts .profile-toast--error {
	border-color: rgba(235, 77, 75, 0.45);
	color: #ffb4b2;
	}
.site-chat-toasts .profile-toast--warning {
	border-color: rgba(241, 196, 15, 0.45);
	color: #f1c40f;
	}
.site-chat-toasts .profile-toast--success {
	border-color: rgba(178, 222, 67, 0.45);
	}
