/* SITE CHAT — getasset_dark
   Modes: closed (FAB) → open (floating window) → expanded (sticky full-height)
----------------------------------------------- */
.d-none { display: none !important; }

.site-chat {
	--chat-w: 360px;
	--chat-h: min(520px, calc(100dvh - 96px));
	--chat-w-exp: 440px;
	--chat-accent: var(--color-brand, #76b900);
	--chat-surface: var(--color-surface, #1a1a1a);
	--chat-surface-2: var(--color-surface-2, #222);
	--chat-line: var(--color-line, #333);
	--chat-text: var(--color-text, #fff);
	--chat-muted: var(--color-text-3, #999);
	position: fixed;
	inset: 0;
	z-index: 850;
	pointer-events: none;
	font-size: 13px;
	font-family: var(--font-sans, Rubik, "Segoe UI", sans-serif);
}

/* —— FAB (closed) —— */
.site-chat__fab {
	pointer-events: auto;
	position: fixed;
	right: 40px;
	bottom: calc(40px + env(safe-area-inset-bottom, 0px));
	z-index: 860;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 44px;
	padding: 0 25px 0 25px;
	border: 0px solid var(--chat-line);
	border-radius: var(--radius-pill, 999px);
	background: var(--chat-surface);
	color: var(--chat-text);
	cursor: pointer;
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.07),0 0 0 1px rgba(255,255,255,0.04);
	transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.site-chat__fab:hover {
	border-color: var(--color-line-strong, #666);
	background: var(--chat-surface-2);
}
.site-chat__fab-icon {
	font-size: 16px;
	color: var(--chat-accent);
	line-height: 1;
}
.site-chat__fab-label {
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.01em;
	white-space: nowrap;
}
.site-chat__fab-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 24px;
	height: 24px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--color-danger, #f4511e);
	color: #fff;
	font-size: 10px;
	font-weight: 400;
	line-height: 23px;
	text-align: center;
	border: 0px solid var(--color-bg, #111);
}
.site-chat.is-open .site-chat__fab { display: none; }

.site-chat__toggle { display: none !important; }
.site-chat__badge[hidden] { display: none !important; }

/* —— Panel —— */
.site-chat__panel {
	pointer-events: none;
	position: fixed;
	right: 20px;
	bottom: calc(20px + env(safe-area-inset-bottom, 0px));
	width: var(--chat-w);
	height: var(--chat-h);
	display: flex;
	flex-direction: column;
	background: var(--chat-surface);
	border: 0px solid var(--chat-line);
	border-radius: var(--radius-m, 12px);
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	visibility: hidden;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, width 0.25s ease, height 0.25s ease, top 0.25s ease, bottom 0.25s ease, right 0.25s ease, border-radius 0.2s ease;
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.07),0 0 0 1px rgba(255,255,255,0.04);
}
.site-chat.is-open .site-chat__panel {
	pointer-events: auto;
	opacity: 1;
	transform: none;
	visibility: visible;
}

/* Expanded: sticky full-height column */
.site-chat.is-expanded.is-open .site-chat__panel {
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--chat-w-exp);
	height: auto;
	border-right: 0;
	z-index: -1;
	border-radius: 14px 0px 0px 0px;
	border-top: 0px solid var(--chat-line);
}

.site-chat__content {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	width: 100%;
}

.site-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 14px;
	margin: 10px 10px 0px 10px;
	border-bottom: 0px solid var(--chat-line);
	border-radius: 14px;
	flex-shrink: 0;
	background: var(--color-line);
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.07),0 0 0 1px rgba(255,255,255,0.04);
}
.site-chat__header-left {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}
.site-chat__title {
	font-weight: 600;
	font-size: 15px;
	color: var(--chat-text);
}
.site-chat__online-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 26px;
	padding: 0 10px;
	border: 1px solid var(--chat-line);
	border-radius: var(--radius-pill, 999px);
	background: var(--chat-surface-2);
	color: var(--chat-muted);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}
.site-chat__online-btn:hover {
	color: var(--chat-text);
	border-color: var(--color-line-strong, #666);
}
.site-chat__online-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--chat-accent);
	box-shadow: 0 0 0 2px rgba(118, 185, 0, 0.2);
}
.site-chat__header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	position: relative;
	flex-shrink: 0;
}
.site-chat__expand-btn,
.site-chat__settings-btn,
.site-chat__close {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: var(--chat-surface-2);
	color: var(--chat-muted);
	font-size: 14px;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.site-chat__expand-btn:hover,
.site-chat__expand-btn.is-active,
.site-chat__settings-btn:hover,
.site-chat__settings-btn.is-open,
.site-chat__close:hover {
	color: var(--chat-accent);
}

.site-chat__settings { position: relative; }
.site-chat__settings-menu {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 240px;
	padding: 6px;
	border-radius: 10px;
	background: var(--color-line-strong);
	border: 0px solid var(--chat-line);
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.07),0 0 0 1px rgba(255,255,255,0.04);
	z-index: 5;
}
.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(--chat-text);
	text-align: left;
	text-decoration: none;
	font-size: 13px;
	cursor: pointer;
	border-radius: 999px;
}
.site-chat__settings-item:hover {
	background: rgba(255, 255, 255, 0.06);
}
.site-chat__settings-item.is-muted { color: var(--chat-muted); }
.site-chat__settings-item-icon { width: 16px; text-align: center; }
.site-chat__settings-link { display: flex; }
.site-chat__settings-divider {
	height: 1px;
	margin: 4px 6px;
	background: #3d3d3d;
}
.site-chat__settings-item--danger { color: #ff8a80; }
.site-chat__settings-item--danger:hover { color: #ffab91; }

.site-chat__rooms {
	display: flex;
	gap: 6px;
	padding: 10px 12px;
	border-bottom: 1px solid var(--chat-line);
	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(--chat-surface-2);
	color: var(--chat-muted);
	font-size: 11px;
	cursor: pointer;
	white-space: nowrap;
}
.site-chat__room.is-active,
.site-chat__room:hover {
	background: var(--color-surface-3, #2e2e2e);
	color: var(--chat-text);
}
.site-chat__room-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--color-danger, #f4511e);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 14px;
	text-align: center;
	border: 2px solid var(--chat-surface);
}

/* Inline online block stays hidden — list is in modal */
.site-chat__online { display: none !important; }

.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(--chat-muted);
	background: rgba(118, 185, 0, 0.08);
	border-bottom: 1px solid var(--chat-line);
	flex-shrink: 0;
}
.site-chat__guest a { color: var(--chat-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(--chat-muted);
}

.site-chat__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	scrollbar-width: thin;
}
.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(--chat-line);
	background: var(--chat-surface-2);
	cursor: pointer;
}
.site-chat__msg-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.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(--chat-muted);
}
.site-chat__msg-name {
	font-weight: 600;
	color: var(--color-text-2, #ddd);
	text-decoration: none;
}
.site-chat__msg-name:hover { color: var(--chat-accent); }
.site-chat__msg-reply-link {
	border: 0;
	padding: 0;
	background: none;
	color: var(--chat-accent);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.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(118, 185, 0, 0.45); }
}
.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(--color-line);
	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(--chat-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;
}
.site-chat__msg-actions:empty { display: none; }
.site-chat__msg-action {
	border: 0;
	background: none;
	color: var(--chat-muted);
	font-size: 11px;
	cursor: pointer;
	padding: 2px 4px;
}
.site-chat__msg-action:hover { color: var(--chat-text); }
.chat-mention { color: var(--chat-accent); font-weight: 600; }

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

.site-chat__form {
	padding: 2px 2px;
	border-top: 0px solid var(--chat-line);
	flex-shrink: 0;
	margin: 0px 10px 10px 10px;
	border-radius: 999px;
}
.site-chat__form[hidden] { display: none !important; }
.site-chat__messages[hidden] { display: none !important; }
.site-chat__compose {
	display: flex;
	align-items: center;
	width: 100%;
	gap: 2px;
	border-radius: 999px;
	padding: 4px;
	border: 0px solid var(--chat-line);
	background: var(--color-line);
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.07),0 0 0 1px rgba(255,255,255,0.04);
}
.site-chat__compose:focus-within {
	border-color: var(--chat-accent);
}
.site-chat__emoji-picker {
	margin-bottom: 8px;
	padding: 8px;
	border: 0px solid var(--chat-line);
	border-radius: 12px;
	background: var(--color-line-strong);
}
.site-chat__emoji-picker[hidden] { display: none !important; }
.site-chat__emoji-grid {
	display: grid;
	grid-template-columns: repeat(8, minmax(0, 1fr));
	gap: 4px;
	max-height: 220px;
	overflow-y: auto;
	scrollbar-width: thin;
}
.site-chat__emoji-item {
	width: 100%;
	aspect-ratio: 1;
	border: 0;
	border-radius: 8px;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}
.site-chat__emoji-item:hover { background: rgba(255, 255, 255, 0.08); }
.site-chat__emoji-btn {
	font-size: 20px;
	line-height: 1;
}
.site-chat__emoji-btn.is-active {
	background: rgba(255, 255, 255, 0.08);
	color: var(--chat-text);
}
.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(--chat-text);
	font-size: 13px;
	font-family: inherit;
	resize: none;
	overflow-y: auto;
	box-sizing: border-box;
}
.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(--chat-muted);
	font-size: 15px;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.site-chat__attach { cursor: pointer; margin: 0; }
.site-chat__attach input { display: none; }
.site-chat__compose-btn--send {
	background: var(--chat-line);
	color: var(--chat-text);
	border-radius: 999px;
}
.site-chat__compose-btn--send:hover {
	color: var(--chat-accent);
}

/* Online modal */
.site-chat-online-modal {
	pointer-events: auto;
	position: fixed;
	inset: 0;
	z-index: 920;
	display: grid;
	place-items: center;
	padding: 24px;
}
.site-chat-online-modal[hidden] { display: none !important; }
.site-chat-online-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}
.site-chat-online-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(360px, 100%);
	max-height: min(480px, 80vh);
	display: flex;
	flex-direction: column;
	background: var(--chat-surface);
	border: 1px solid var(--chat-line);
	border-radius: var(--radius-m, 12px);
	box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
	overflow: hidden;
}
.site-chat-online-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var(--chat-line);
}
.site-chat-online-modal__title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--chat-text);
}
.site-chat-online-modal__close {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: var(--chat-surface-2);
	color: var(--chat-muted);
	cursor: pointer;
}
.site-chat-online-modal__list {
	padding: 12px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.site-chat-online-modal__user {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-radius: 8px;
	background: var(--chat-surface-2);
	color: var(--chat-text);
	font-size: 13px;
}
.site-chat-online-modal__user::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--online-dot, var(--chat-accent));
	flex-shrink: 0;
}
.site-chat-online-modal__empty {
	padding: 24px 12px;
	text-align: center;
	color: var(--chat-muted);
	font-size: 13px;
}

/* Lightbox */
.site-chat-lightbox {
	pointer-events: auto;
	position: fixed;
	inset: 0;
	z-index: 950;
	display: grid;
	place-items: center;
}
.site-chat-lightbox[hidden] { display: none !important; }
.site-chat-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
}
.site-chat-lightbox__img {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 1100px);
	max-height: 88vh;
	object-fit: contain;
	border-radius: 8px;
}
.site-chat-lightbox__close,
.site-chat-lightbox__nav {
	position: absolute;
	z-index: 2;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(26, 26, 26, 0.9);
	color: #fff;
	cursor: pointer;
}
.site-chat-lightbox__close { top: 16px; right: 16px; }
.site-chat-lightbox__nav--prev { left: 16px; top: 50%; transform: translateY(-50%); }
.site-chat-lightbox__nav--next { right: 16px; top: 50%; transform: translateY(-50%); }

.site-chat-toasts {
	pointer-events: none;
	position: fixed;
	right: 20px;
	bottom: 80px;
	z-index: 960;
}

body.profile-modal-open .site-chat__fab { opacity: 0; pointer-events: none; }

/* На мобиле чат открывается из нижней панели — FAB скрыт */
@media screen and (max-width: 1080px) {
	.site-chat__fab {
		display: none !important;
	}
}

@media screen and (max-width: 767px) {
	.site-chat__fab {
		right: 12px;
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	}
	.site-chat.is-open {
		z-index: 960;
	}
	.site-chat.is-open .site-chat__panel,
	.site-chat.is-expanded.is-open .site-chat__panel {
		inset: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		right: 0;
		bottom: 0;
		top: 0;
		border-radius: 0;
		border: 0;
	}
	.site-chat__expand-btn { display: none !important; }
	body.chat-is-open {
		overflow: hidden;
		touch-action: none;
	}
}

@media screen and (min-width: 768px) {
	.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;
	}
}
