/* Desktop keeps the theme's original search exactly as it is. */
.xgames-mobile-search-trigger,
.xgames-mobile-search {
	display: none;
}

@media (max-width: 767px) {
	/* Added by the script only when FiboSearch was found in the header. */
	.xgames-mobile-search-source {
		display: none !important;
	}

	.xgames-mobile-search:not([hidden]) .xgames-mobile-search-source {
		display: block !important;
	}

	.xgames-mobile-search-trigger {
		align-items: center;
		appearance: none;
		background: transparent;
		border: 0;
		border-radius: 999px;
		color: inherit;
		cursor: pointer;
		display: inline-flex;
		flex: 0 0 42px;
		height: 42px;
		justify-content: center;
		margin: 0;
		padding: 0;
		transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
		width: 42px;
	}

	.xgames-mobile-search-trigger:hover,
	.xgames-mobile-search-trigger:focus-visible {
		background: rgba(255, 255, 255, 0.1);
		outline: none;
	}

	.xgames-mobile-search-trigger:active {
		transform: scale(0.94);
	}

	.xgames-mobile-search-trigger svg {
		height: 21px;
		width: 21px;
	}

	.xgames-mobile-search {
		inset: 0;
		position: fixed;
		z-index: 2147483000;
	}

	.xgames-mobile-search[hidden] {
		display: none;
	}

	.xgames-mobile-search:not([hidden]) {
		display: block;
	}

	.xgames-mobile-search__backdrop {
		backdrop-filter: blur(5px);
		background: rgba(5, 7, 12, 0.76);
		inset: 0;
		position: absolute;
	}

	.xgames-mobile-search__dialog {
		background: #ffffff;
		box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
		left: 16px;
		padding: 18px 16px 16px;
		position: absolute;
		right: 16px;
		top: max(18px, env(safe-area-inset-top));
	}

	.xgames-mobile-search__topline {
		align-items: center;
		display: flex;
		gap: 12px;
		justify-content: space-between;
		margin-bottom: 14px;
	}

	.xgames-mobile-search__title {
		color: #17171b;
		font-size: 15px;
		font-weight: 700;
		letter-spacing: 0.01em;
		margin: 0;
	}

	.xgames-mobile-search__close {
		align-items: center;
		appearance: none;
		background: #f1f1f3;
		border: 0;
		border-radius: 50%;
		color: #17171b;
		cursor: pointer;
		display: inline-flex;
		font-size: 25px;
		height: 34px;
		justify-content: center;
		line-height: 1;
		padding: 0 0 3px;
		width: 34px;
	}

	.xgames-mobile-search__close:focus-visible {
		box-shadow: 0 0 0 3px rgba(0, 112, 209, 0.3);
		outline: none;
	}

	/* The original FiboSearch node is moved here, never copied. */
	.xgames-mobile-search__form .dgwt-wcas-search-wrapp {
		margin: 0 !important;
		max-width: none !important;
		width: 100%;
	}

	.xgames-mobile-search__form .dgwt-wcas-sf-wrapp {
		width: 100%;
	}

	.xgames-mobile-search__form .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
		background: #f2f2f4;
		border: 1px solid transparent !important;
		border-radius: 0 !important;
		box-sizing: border-box;
		color: #17171b;
		font-size: 16px;
		line-height: 1.3;
		min-height: 46px;
		padding: 11px 13px;
		width: 100%;
	}

	.xgames-mobile-search__form .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:focus {
		background: #fff;
		border-color: #0070d1;
		box-shadow: 0 0 0 3px rgba(0, 112, 209, 0.16);
		outline: none;
	}

	.xgames-mobile-search__form .dgwt-wcas-suggestions-wrapp {
		box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
	}

	.xgames-mobile-search__form .dgwt-wcas-search-input::placeholder {
		color: #6b6b72 !important;
		opacity: 1;
	}
}

@media (prefers-reduced-motion: no-preference) and (max-width: 767px) {
	.xgames-mobile-search__dialog {
		animation: xgames-search-dialog-in 180ms ease-out both;
	}

	@keyframes xgames-search-dialog-in {
		from { opacity: 0; transform: translateY(-8px); }
		to { opacity: 1; transform: translateY(0); }
	}
}
