/* ============================================================
   Хеллоуин (#814). Подключается только при включённом флаге в /apn/halloween.
   Палитра: тыква #ff7a1a, ядовитый фиолетовый #9b6bff, болотный #8be04e.
   Все слои декоративные: pointer-events: none, кроме тыкв и фонаря охоты.
   ============================================================ */

body.zmHalloween {
	--hw-pumpkin: #ff7a1a;
	--hw-pumpkin-rgb: 255, 122, 26;
	--hw-violet: #9b6bff;
	--hw-violet-rgb: 155, 107, 255;
	--hw-slime: #8be04e;
	--hw-slime-rgb: 139, 224, 78;
}

/* Во время игры в слот оформление не мешает */
body.zmHalloween.casino-game-fullscreen-page .zmHw-sky,
body.zmHalloween.casino-game-fullscreen-page .zmHw-garland,
body.zmHalloween.casino-game-fullscreen-page .zmHw-lantern,
body.zmHalloween.casino-game-fullscreen-page .zmHw-spot {
	display: none !important;
}

/* ---------- Гирлянда по верхнему краю ---------- */
.zmHw-garland {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 46px;
	z-index: 70;
	pointer-events: none;
	overflow: visible;
}

.zmHw-garland::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 64px;
	background: linear-gradient(to bottom, rgba(255, 138, 40, 0.11), rgba(155, 107, 255, 0.05) 45%, transparent);
}

.zmHw-garland svg {
	position: relative;
	display: block;
	overflow: visible;
}

.zmHw-garland__wire {
	fill: none;
	stroke: #0e0a14;
	stroke-width: 2.2;
	stroke-linecap: round;
}

.zmHw-garland__wire--2 {
	stroke: #1d1626;
	stroke-width: 1.3;
}

.zmHw-garland__wireShine {
	fill: none;
	stroke: rgba(255, 255, 255, 0.12);
	stroke-width: 0.7;
	transform: translateY(-0.6px);
}

.zmHw-bulb__off {
	fill: rgba(46, 36, 58, 0.92);
}

.zmHw-bulb {
	animation: zmHwBulb 3.4s ease-in-out infinite;
}

.zmHw-bulb__shine {
	fill: none;
	stroke: rgba(255, 255, 255, 0.75);
	stroke-width: 0.9;
	stroke-linecap: round;
}

.zmHw-bulb__ridge {
	stroke: rgba(0, 0, 0, 0.4);
	stroke-width: 0.5;
}

.zmHw-hook__cord {
	stroke: #0e0a14;
	stroke-width: 1.2;
}

.zmHw-hook__rib {
	fill: none;
	stroke: rgba(110, 36, 0, 0.55);
	stroke-width: 0.7;
}

.zmHw-hook__stem {
	stroke: #4d7a24;
	stroke-width: 1.4;
	stroke-linecap: round;
}

.zmHw-hook__face {
	fill: #ffe07a;
	stroke: #ffe07a;
	stroke-width: 0.6;
	stroke-linejoin: round;
	filter: drop-shadow(0 0 1.5px rgba(255, 210, 90, 0.9));
}

/* Огонёк бежит волной вдоль провода: короткое затухание и вспышка */
@keyframes zmHwBulb {
	0%, 56%, 100% { opacity: 1; }
	64% { opacity: 0.12; }
	70% { opacity: 0.12; }
	78% { opacity: 1; }
}

/* ---------- Паутина с паучком на логотипе ---------- */
.zmHw-web {
	position: absolute;
	top: 0;
	right: 0;
	width: 46px;
	height: 46px;
	z-index: 3;
	pointer-events: none;
	opacity: 0.55;
}

.zmHw-web svg {
	display: block;
	width: 100%;
	height: 100%;
}

.zmHw-spider {
	position: absolute;
	top: 0;
	right: 14px;
	width: 12px;
	z-index: 4;
	pointer-events: none;
	animation: zmHwSpider 16s ease-in-out infinite;
}

.zmHw-spider__thread {
	display: block;
	width: 1px;
	height: 60px;
	margin: -48px auto 0;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.55));
}

.zmHw-spider svg {
	display: block;
	width: 12px;
	height: 12px;
	margin-top: -1px;
	animation: zmHwSpiderWiggle 1.6s ease-in-out infinite;
}

@keyframes zmHwSpider {
	0%, 18% { transform: translateY(-14px); }
	30% { transform: translateY(26px); }
	34% { transform: translateY(22px); }
	52% { transform: translateY(24px); }
	66%, 100% { transform: translateY(-14px); }
}

@keyframes zmHwSpiderWiggle {
	0%, 100% { transform: rotate(-6deg); }
	50% { transform: rotate(6deg); }
}

body.leftBlockCollapsed .zmHw-web {
	width: 30px;
	height: 30px;
}

body.leftBlockCollapsed .zmHw-spider {
	display: none;
}

/* ---------- Небо: летучие мыши и ведьма ---------- */
.zmHw-sky {
	position: fixed;
	inset: 0;
	z-index: 60;
	pointer-events: none;
	overflow: hidden;
}

.zmHw-flyer {
	position: absolute;
	left: 0;
	top: 0;
	will-change: transform;
}

.zmHw-flyer svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.zmHw-bat {
	width: 38px;
	filter: drop-shadow(0 0 2px rgba(169, 123, 255, 0.95)) drop-shadow(0 0 9px rgba(var(--hw-violet-rgb), 0.6));
}

.zmHw-bat svg {
	animation: zmHwFlap 0.22s ease-in-out infinite alternate;
	transform-origin: 50% 40%;
}

@keyframes zmHwFlap {
	from { transform: scaleY(1); }
	to { transform: scaleY(0.5); }
}

.zmHw-witch {
	width: 130px;
	filter: drop-shadow(0 0 2px rgba(255, 150, 60, 0.95)) drop-shadow(0 0 10px rgba(var(--hw-pumpkin-rgb), 0.6));
}

.zmHw-witch svg {
	animation: zmHwBob 1.6s ease-in-out infinite alternate;
}

@keyframes zmHwBob {
	from { transform: translateY(-3px) rotate(-3deg); }
	to { transform: translateY(3px) rotate(2deg); }
}

/* ---------- Шапочки на аватарах в чате ---------- */
body.zmHalloween.zmHw-hats .rightBlockChat .rightBlockChatAvatarLink {
	position: relative;
}

/* У модератора аватар без ссылки — шапка на ::after обёртки (у этого статуса он свободен) */
body.zmHalloween.zmHw-hats .rightBlockChat .rightBlockChatAvatarLink::after,
body.zmHalloween.zmHw-hats .rightBlockChat .rightBlockChatMessageBlock--st-moderator .rightBlockChatAvatarWrap::after {
	content: "";
	position: absolute;
	top: -5px;
	left: 50%;
	width: 38px;
	height: 28px;
	margin-left: -20px;
	transform: rotate(-14deg);
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 44'%3E%3Cpath d='M33 2C27 9 22 19 19 30h22C39 22 38 14 44 9c-4 2-7 1-11-7z' fill='%232a1840'/%3E%3Cpath d='M33 2c-3 6-6 13-8 22' stroke='%23523080' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3Cellipse cx='30' cy='33' rx='28' ry='7' fill='%231d1030'/%3E%3Cpath d='M19 28h22l1 5H18z' fill='%23ff7a1a'/%3E%3Crect x='27' y='27.5' width='6' height='6' rx='1' fill='none' stroke='%23ffd36b' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
	pointer-events: none;
	z-index: 2;
}

body.zmHalloween.zmHw-hats .rightBlockChat .rbchmb2 .rightBlockChatAvatarLink::after,
body.zmHalloween.zmHw-hats .rightBlockChat .rbchmb2.rightBlockChatMessageBlock--st-moderator .rightBlockChatAvatarWrap::after {
	transform: rotate(12deg) scaleX(-1);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 44'%3E%3Cpath d='M33 2C27 9 22 19 19 30h22C39 22 38 14 44 9c-4 2-7 1-11-7z' fill='%23151a12'/%3E%3Cpath d='M33 2c-3 6-6 13-8 22' stroke='%23384a2a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3Cellipse cx='30' cy='33' rx='28' ry='7' fill='%230e120b'/%3E%3Cpath d='M19 28h22l1 5H18z' fill='%238be04e'/%3E%3Cpath d='M30 26l1.6 3.2 3.4.4-2.5 2.3.7 3.4-3.2-1.7-3.2 1.7.7-3.4-2.5-2.3 3.4-.4z' fill='%23ffd36b'/%3E%3C/svg%3E");
}

/* ---------- Охота: тыква на странице ---------- */
/* Выше любых блоков страницы, но ниже нижнего меню (1050) и окон */
.zmHw-spotWrap {
	position: relative;
	height: 0;
	z-index: 1040;
}

.zmHw-spot {
	position: absolute;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	transform: translate(-50%, 0) scale(0);
	transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
	-webkit-tap-highlight-color: transparent;
	filter: drop-shadow(0 0 10px rgba(var(--hw-pumpkin-rgb), 0.65)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}

.zmHw-spot.is-shown {
	transform: translate(-50%, 0) scale(1);
}

.zmHw-spot svg {
	display: block;
	width: 100%;
	height: 100%;
	animation: zmHwFloat 2.6s ease-in-out infinite;
}

.zmHw-spot::before {
	content: "";
	position: absolute;
	inset: -14px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(var(--hw-pumpkin-rgb), 0.28), transparent 65%);
	animation: zmHwHalo 2.2s ease-in-out infinite;
}

.zmHw-spot.is-caught {
	pointer-events: none;
	transition: transform 0.35s ease-in, opacity 0.35s ease-in;
	transform: translate(-50%, -30px) scale(1.6);
	opacity: 0;
}

@keyframes zmHwFloat {
	0%, 100% { transform: translateY(0) rotate(-4deg); }
	50% { transform: translateY(-6px) rotate(4deg); }
}

@keyframes zmHwHalo {
	0%, 100% { opacity: 0.6; transform: scale(0.9); }
	50% { opacity: 1; transform: scale(1.1); }
}

.zmHw-face {
	animation: zmHwFlicker 3.2s steps(1) infinite;
}

@keyframes zmHwFlicker {
	0%, 100% { opacity: 1; }
	47% { opacity: 1; }
	48% { opacity: 0.55; }
	50% { opacity: 1; }
	83% { opacity: 0.75; }
	85% { opacity: 1; }
}

/* Искры при поимке */
.zmHw-spark {
	position: absolute;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	pointer-events: none;
	animation: zmHwSpark 0.7s ease-out forwards;
}

@keyframes zmHwSpark {
	from { transform: translate(0, 0) scale(1); opacity: 1; }
	to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* ---------- Фонарь охоты: висит на гирлянде по центру ---------- */
.zmHw-lantern {
	position: fixed;
	top: 0;
	left: 50%;
	z-index: 1045;
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: translateX(-50%);
}

.zmHw-lantern__swing {
	display: flex;
	flex-direction: column;
	align-items: center;
	transform-origin: 50% 0;
	animation: zmHwSwing 4s ease-in-out infinite;
}

.zmHw-lantern__rope {
	width: 1px;
	height: 14px;
	background: rgba(20, 16, 28, 0.95);
}

.zmHw-lantern__btn {
	display: flex;
	align-items: center;
	gap: 6px;
	height: 30px;
	padding: 0 11px 0 5px;
	border-radius: 15px;
	border: 1px solid rgba(var(--hw-pumpkin-rgb), 0.55);
	background: linear-gradient(160deg, rgba(42, 24, 56, 0.96), rgba(18, 12, 26, 0.96));
	box-shadow: 0 0 14px rgba(var(--hw-pumpkin-rgb), 0.35), 0 4px 10px rgba(0, 0, 0, 0.5);
	color: #ffe2c2;
	font-family: 'Roboto Condensed', sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.03em;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.zmHw-lantern__btn svg {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.zmHw-lantern__btn b {
	color: var(--hw-pumpkin);
}

.zmHw-lantern.is-done .zmHw-lantern__btn {
	border-color: rgba(var(--hw-slime-rgb), 0.6);
	box-shadow: 0 0 14px rgba(var(--hw-slime-rgb), 0.35), 0 4px 10px rgba(0, 0, 0, 0.5);
}

.zmHw-lantern.is-done .zmHw-lantern__btn b {
	color: var(--hw-slime);
}

.zmHw-lantern.is-bump .zmHw-lantern__btn {
	animation: zmHwBump 0.5s ease-out;
}

.zmHw-lantern.is-gone {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.4s ease, visibility 0.4s;
}

@keyframes zmHwSwing {
	0%, 100% { transform: rotate(-2.5deg); }
	50% { transform: rotate(2.5deg); }
}

@keyframes zmHwBump {
	0% { transform: scale(1); }
	40% { transform: scale(1.18); }
	100% { transform: scale(1); }
}

@media (hover: hover) and (pointer: fine) {
	.zmHw-lantern__btn:hover {
		border-color: var(--hw-pumpkin);
		color: #fff;
	}
}

/* Поповер с правилами */
.zmHw-pop {
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	width: 270px;
	margin-left: -135px;
	padding: 14px 16px;
	border-radius: 14px;
	border: 1px solid rgba(var(--hw-violet-rgb), 0.45);
	background: linear-gradient(165deg, #23163a, #120d1c);
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), 0 0 22px rgba(var(--hw-violet-rgb), 0.18);
	color: #d9d2ea;
	font-size: 12.5px;
	line-height: 1.45;
	text-align: left;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.zmHw-lantern.is-open .zmHw-pop {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.zmHw-pop__title {
	margin-bottom: 6px;
	color: #fff;
	font-family: 'Luckiest Guy', 'Roboto Condensed', sans-serif;
	font-size: 17px;
	letter-spacing: 0.04em;
	color: var(--hw-pumpkin);
	text-shadow: 0 0 10px rgba(var(--hw-pumpkin-rgb), 0.45);
}

.zmHw-pop__dots {
	display: flex;
	gap: 6px;
	margin: 10px 0 8px;
}

.zmHw-pop__dots svg {
	width: 24px;
	height: 24px;
	opacity: 0.28;
	filter: grayscale(1);
}

.zmHw-pop__dots svg.is-found {
	opacity: 1;
	filter: drop-shadow(0 0 5px rgba(var(--hw-pumpkin-rgb), 0.7));
}

.zmHw-pop__note {
	color: #a99fc0;
	font-size: 11.5px;
}

.zmHw-pop__note b {
	color: var(--hw-slime);
}

/* ---------- Тост ---------- */
.zmHw-toast {
	position: fixed;
	top: 62px;
	left: 50%;
	z-index: 1400;
	max-width: min(92vw, 360px);
	padding: 10px 16px;
	border-radius: 12px;
	border: 1px solid rgba(var(--hw-pumpkin-rgb), 0.5);
	background: linear-gradient(160deg, rgba(42, 24, 56, 0.97), rgba(18, 12, 26, 0.97));
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
	color: #ffe9d4;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	pointer-events: none;
	opacity: 0;
	transform: translate(-50%, -8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.zmHw-toast.is-shown {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* ---------- Окно награды ---------- */
.zmHw-modal {
	position: fixed;
	inset: 0;
	z-index: 1450;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(8, 5, 14, 0.72);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.zmHw-modal.is-shown {
	opacity: 1;
}

.zmHw-modal__box {
	position: relative;
	width: 100%;
	max-width: 340px;
	padding: 26px 24px 22px;
	border-radius: 20px;
	border: 1px solid rgba(var(--hw-pumpkin-rgb), 0.5);
	background:
		radial-gradient(260px 160px at 50% 0%, rgba(var(--hw-pumpkin-rgb), 0.22), transparent 70%),
		linear-gradient(170deg, #26173b, #110c1a);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(var(--hw-pumpkin-rgb), 0.18);
	color: #e2dbef;
	text-align: center;
	transform: scale(0.85);
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.zmHw-modal.is-shown .zmHw-modal__box {
	transform: scale(1);
}

.zmHw-modal__pumpkin {
	width: 84px;
	height: 84px;
	margin: -62px auto 8px;
	filter: drop-shadow(0 0 18px rgba(var(--hw-pumpkin-rgb), 0.75));
}

.zmHw-modal__pumpkin svg {
	width: 100%;
	height: 100%;
	animation: zmHwFloat 2.6s ease-in-out infinite;
}

.zmHw-modal__title {
	margin-bottom: 8px;
	font-family: 'Luckiest Guy', 'Roboto Condensed', sans-serif;
	font-size: 24px;
	letter-spacing: 0.04em;
	color: var(--hw-pumpkin);
	text-shadow: 0 0 14px rgba(var(--hw-pumpkin-rgb), 0.5);
}

.zmHw-modal__text {
	margin-bottom: 18px;
	font-size: 14px;
	line-height: 1.45;
}

.zmHw-modal__actions {
	display: flex;
	gap: 8px;
}

.zmHw-modal__btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	border-radius: 11px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(255, 255, 255, 0.06);
	color: #e2dbef;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.zmHw-modal__btn--main {
	border-color: rgba(var(--hw-pumpkin-rgb), 0.7);
	background: linear-gradient(160deg, #ff8d2e, #d4570c);
	color: #fff;
	box-shadow: 0 6px 18px rgba(var(--hw-pumpkin-rgb), 0.35);
}

@media (hover: hover) and (pointer: fine) {
	.zmHw-modal__btn:hover {
		color: #fff;
		text-decoration: none;
		filter: brightness(1.1);
	}
}

/* ---------- Мобильные ---------- */
@media (max-width: 767px) {
	/* Сверху по центру фонарь закрывал шапку страниц и баланс турнира: на мобильных он у правого края */
	.zmHw-lantern {
		top: 46%;
		left: auto;
		right: 0;
		transform: none;
	}

	.zmHw-lantern__rope {
		display: none;
	}

	.zmHw-lantern__swing {
		animation: none;
	}

	.zmHw-lantern__btn {
		height: 26px;
		padding: 0 8px 0 4px;
		border-right: 0;
		border-radius: 13px 0 0 13px;
		font-size: 11px;
	}

	.zmHw-pop {
		top: 50%;
		left: auto;
		right: calc(100% + 8px);
		width: min(270px, calc(100vw - 96px));
		margin-left: 0;
		transform: translate(6px, -50%);
	}

	.zmHw-lantern.is-open .zmHw-pop {
		transform: translate(0, -50%);
	}

	.zmHw-lantern__btn svg {
		width: 18px;
		height: 18px;
	}

	.zmHw-spot {
		width: 52px;
		height: 52px;
	}
}

/* ---------- Без анимаций для тех, кто их отключил ---------- */
@media (prefers-reduced-motion: reduce) {
	.zmHw-bulb,
	.zmHw-spider,
	.zmHw-spider svg,
	.zmHw-lantern__swing,
	.zmHw-spot svg,
	.zmHw-spot::before,
	.zmHw-face,
	.zmHw-modal__pumpkin svg {
		animation: none !important;
	}

	.zmHw-sky {
		display: none;
	}
}
