/* 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;
	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: 8px;
	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;
	}
.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;
	}
.site-chat.is-open .site-chat__panel {right: 0;}
.site-chat.is-open .site-chat__toggle {right: var(--chat-w);}

.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__admin {
	position: relative;
	}
.site-chat__admin-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__admin-btn:hover,
.site-chat__admin-btn.is-open {
	color: var(--accent);
	}
.site-chat__admin-menu {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 210px;
	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__admin-link {
	display: block;
	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__admin-link:hover {
	background: rgba(255,255,255,0.06);
	color: var(--accent);
	}
.site-chat__admin-link--danger {
	color: #ff8a80;
	}
.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;
	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.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: 24px 16px;
	text-align: center;
	color: var(--tt-fade);
	line-height: 1.5;
	}
.site-chat__guest a {color: var(--accent);}
.site-chat__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	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: column;
	gap: 4px;
	max-width: 92%;
	position: relative;
	}
.site-chat__msg.is-own {align-self: flex-end; align-items: flex-end;}
.site-chat__msg.is-other {align-self: flex-start; align-items: flex-start;}
.site-chat__msg-head {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: var(--tt-fade);
	}
.site-chat__msg-name {font-weight: 600; color: var(--tt-fade-0);}
.site-chat__msg-group {
	padding: 1px 6px;
	border-radius: 4px;
	font-size: 9px;
	font-weight: 700;
	text-transform: uppercase;
	}
.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: none;
	gap: 4px;
	margin-top: 2px;
	}
.site-chat__msg:hover .site-chat__msg-actions {display: flex;}
.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__guest[hidden] {display: none !important;}
.site-chat__messages[hidden] {display: none !important;}
.site-chat__compose {
	display: flex;
	align-items: center;
	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__compose.is-listening {
	border-color: #e74c3c;
	box-shadow: 0 0 0 2px rgba(231,76,60,0.2);
	}
.site-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 36px;
	padding: 0 8px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--tt);
	font-size: 13px;
	}
.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);
	}
.site-chat__voice.is-active {background: rgba(231,76,60,0.18); color: #e74c3c;}

body.chat-is-open .wrapper__container--main {
	margin-right: var(--chat-w);
	transition: margin-right 0.3s ease;
	}
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 {display: flex;}
	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);}
	}

@media screen and (min-width: 1220px) {
	.site-chat__toggle:hover {background: var(--bg-darker); color: var(--accent);}
	.site-chat__close:hover {color: var(--accent);}
	.site-chat__attach:hover,
	.site-chat__voice:hover {color: var(--accent);}
	.site-chat__compose-btn--send:hover {filter: brightness(1.08);color: var(--accent);}
	}
