/**
 * Mix Of Emojis — фронтенд-стили пикера.
 *
 * Упрощённая версия:
 * - без поиска;
 * - без тонов кожи;
 * - только категории, недавние эмодзи и панель выбора.
 */

.moe-wrap,
.moe-wrap *,
.moe-wrap *::before,
.moe-wrap *::after {
	box-sizing: border-box;
}

.moe-wrap {
	position: relative;
}

.moe-wrap textarea.moe-field {
	padding-right: 46px;
}

.moe-button {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	cursor: pointer;
	opacity: 0.82;
	transition: opacity 0.18s ease, background-color 0.18s ease;
}

.moe-button:hover,
.moe-button:focus-visible {
	opacity: 1;
	background: rgba(15, 23, 42, 0.06);
}

.moe-button:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.moe-button-icon {
	display: block;
	font-size: 18px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	pointer-events: none;
}

.moe-picker {
	--moe-border: #d0d7de;
	--moe-border-soft: #e5e7eb;
	--moe-surface: #ffffff;
	--moe-surface-muted: #f8fafc;
	--moe-surface-hover: #f3f4f6;
	--moe-text-muted: #6b7280;
	--moe-focus: #2271b1;
	position: absolute;
	z-index: 9999;
	width: 316px;
	height: 280px;
	background: var(--moe-surface);
	border: 1px solid var(--moe-border);
	border-radius: 14px;
	box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
	overflow: hidden;
	font-family: inherit;
}

.moe-picker[hidden] {
	display: none !important;
}

.moe-picker-inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
}

.moe-picker-position-top {
	bottom: calc(100% + 8px);
	right: 0;
}

.moe-picker-position-bottom {
	top: calc(100% + 8px);
	right: 0;
}

.moe-picker-position-right {
	top: 0;
	left: calc(100% + 8px);
	right: auto;
}

.moe-filters {
	display: flex;
	align-items: stretch;
	gap: 2px;
	flex: 0 0 auto;
	min-height: 42px;
	padding: 0 8px;
	background: var(--moe-surface-muted);
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;
}

.moe-filters-position-top .moe-filters {
	order: 0;
	border-bottom: 1px solid var(--moe-border-soft);
	border-radius: 14px 14px 0 0;
}

.moe-filters-position-bottom .moe-filters {
	order: 2;
	border-top: 1px solid var(--moe-border-soft);
	border-radius: 0 0 14px 14px;
}

.moe-scroll-area {
	flex: 1 1 auto;
	order: 1;
	min-height: 0;
	padding: 8px;
	background: var(--moe-surface);
	overflow-y: auto;
	overflow-x: hidden;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.moe-scroll-area::-webkit-scrollbar,
.moe-filters::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

.moe-scroll-area::-webkit-scrollbar-thumb,
.moe-filters::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 999px;
}

.moe-filter {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	min-height: 42px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
	transition: background-color 0.16s ease;
}

.moe-filter:hover {
	background: rgba(15, 23, 42, 0.05);
}

.moe-filter:focus-visible {
	outline: 2px solid var(--moe-focus);
	outline-offset: -2px;
}

.moe-filter-active {
	background: var(--moe-surface);
	box-shadow: inset 0 0 0 1px var(--moe-border-soft);
}

.moe-filter-icon {
	display: block;
	font-size: 18px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	pointer-events: none;
}

.moe-category {
	margin-bottom: 8px;
}

.moe-category-title {
	position: sticky;
	top: 0;
	z-index: 2;
	margin: 0 0 4px;
	padding: 6px 4px;
	background: #f9f9c3;
	color: var(--moe-text-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.moe-emoji-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
	gap: 2px;
}

.moe-emoji {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 34px;
	padding: 4px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	font-size: 20px;
	line-height: 1.2;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	cursor: pointer;
	transition: background-color 0.16s ease, transform 0.16s ease;
}

.moe-emoji:hover {
	background: var(--moe-surface-hover);
	transform: scale(1.04);
}

.moe-emoji:focus-visible {
	outline: 2px solid var(--moe-focus);
	outline-offset: -2px;
}

.moe-notice {
	padding: 24px 12px;
	color: var(--moe-text-muted);
	font-size: 13px;
	text-align: center;
}

@media screen and (max-width: 600px) {
	.moe-picker {
		width: min(316px, calc(100vw - 24px));
		right: 0;
		left: auto;
	}

	.moe-picker-position-right {
		top: calc(100% + 8px);
		right: 0;
		left: auto;
	}

	.moe-wrap textarea.moe-field {
		padding-right: 42px;
	}

	.moe-button {
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.moe-scroll-area {
		scroll-behavior: auto;
	}

	.moe-button,
	.moe-filter,
	.moe-emoji {
		transition: none;
	}

	.moe-emoji:hover {
		transform: none;
	}
}

@media print {
	.moe-button,
	.moe-picker {
		display: none !important;
	}
}