/* TrivalRO shared ranking filter controls */

/* Keep the original select in the form for submission/accessibility, but let the
   custom TrivalRO control own the visible UI. */
.trival-native-select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	opacity: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	pointer-events: none !important;
}

.trival-select {
	position: relative;
	display: inline-block;
	width: min(280px, 100%);
	min-width: 240px;
	font-family: 'Informb', sans-serif;
	z-index: 40;
}

.trival-select.is-open {
	z-index: 420;
}

.trival-select__trigger {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	width: 100%;
	min-height: 44px;
	padding: 10px 42px 9px 15px;
	border: 2px solid #a8cce5;
	border-bottom-color: #86b6d8;
	border-radius: 13px;
	background: linear-gradient(180deg, #ffffff 0%, #f7fbfe 100%);
	box-shadow:
		inset 0 2px 0 rgba(255,255,255,.95),
		0 3px 8px rgba(65, 126, 170, .10);
	color: #3c5368;
	font: inherit;
	font-size: 13px;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
	outline: none;
	transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease;
}

.trival-select__trigger::after {
	content: '';
	position: absolute;
	right: 15px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid #49728f;
	border-bottom: 2px solid #49728f;
	transform: translateY(-67%) rotate(45deg);
	transition: transform .16s ease;
}

.trival-select__value {
	display: block;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.trival-select.is-open .trival-select__trigger::after {
	transform: translateY(-30%) rotate(225deg);
}

.trival-select__trigger:hover,
.trival-select__trigger:focus-visible,
.trival-select.is-open .trival-select__trigger {
	border-color: #55b8ef;
	box-shadow:
		inset 0 2px 0 rgba(255,255,255,.98),
		0 0 0 3px rgba(64, 181, 239, .12),
		0 5px 12px rgba(65, 126, 170, .14);
}

.trival-select__menu {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 7px);
	display: none;
	max-height: 310px;
	padding: 7px;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
	border: 1px solid #a9cee7;
	border-bottom: 3px solid #6fa8cf;
	border-radius: 14px;
	background: rgba(255, 255, 255, .985);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.95),
		0 12px 28px rgba(53, 105, 145, .20);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.trival-select__empty {
	display: none;
	padding: 12px 10px 10px;
	color: #71879a;
	font-family: 'Informb', sans-serif;
	font-size: 12px;
	text-align: center;
}

.trival-select__empty.is-visible {
	display: block;
}

.trival-select.is-searching .trival-select__trigger {
	border-color: #55b8ef;
}

.trival-select.is-open .trival-select__menu {
	display: block;
	animation: trivalSelectOpen .15s ease-out;
}

@keyframes trivalSelectOpen {
	from { opacity: 0; transform: translateY(-5px); }
	to { opacity: 1; transform: translateY(0); }
}

.trival-select__option {
	display: block;
	width: 100%;
	margin: 0;
	padding: 9px 11px 8px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: #365067;
	font-family: 'Informb', sans-serif;
	font-size: 12px;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
	transition: background .12s ease, color .12s ease, transform .08s ease;
}

.trival-select__option + .trival-select__option {
	margin-top: 2px;
}

.trival-select__option:hover,
.trival-select__option:focus-visible {
	background: #edf8ff;
	color: #1f79b4;
	outline: none;
	transform: translateX(2px);
}

.trival-select__option.is-type-active:not(.is-selected) {
	background: #edf8ff;
	color: #1f79b4;
	outline: none;
	transform: translateX(2px);
}

.trival-select__option.is-selected {
	background: linear-gradient(180deg, #59c2f5 0%, #31a7ec 52%, #218fd5 100%);
	box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -2px 4px rgba(0,70,120,.20);
	color: #fff;
	font-family: 'Grobold', 'Arial Black', sans-serif;
	font-size: 11px;
	letter-spacing: .4px;
	text-shadow: 0 1px 2px rgba(0,60,110,.50);
}

.trival-select__option:disabled {
	opacity: .45;
	cursor: default;
}

.trival-select__menu::-webkit-scrollbar {
	width: 8px;
}

.trival-select__menu::-webkit-scrollbar-thumb {
	background: rgba(88, 160, 208, .58);
	border: 2px solid transparent;
	border-radius: 999px;
	background-clip: padding-box;
}

/* Shared TrivalRO game buttons for all ranking filters. */
.ranking-filter-form input[type="submit"],
.ranking-legacy-filter input[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	min-height: 44px;
	min-width: 78px;
	padding: 0 18px 3px !important;
	box-sizing: border-box;
	text-align: center;
	border: 1px solid #2a93cf !important;
	border-bottom: 4px solid #1573b0 !important;
	border-radius: 12px !important;
	background: linear-gradient(180deg, #5cc3f5 0%, #34a8ef 48%, #1e90d8 100%) !important;
	box-shadow:
		inset 0 2px 1px rgba(255,255,255,.50),
		inset 0 -3px 6px rgba(0,70,120,.25),
		0 4px 10px rgba(40,130,200,.24) !important;
	color: #fff !important;
	font-family: 'Grobold', 'Arial Black', sans-serif !important;
	font-size: 11px !important;
	font-weight: 400 !important;
	letter-spacing: .8px !important;
	text-transform: uppercase;
	text-shadow: 0 1px 2px rgba(0,60,110,.55);
	cursor: pointer;
	transition: filter .15s ease, transform .08s ease, box-shadow .08s ease;
}

.ranking-filter-form input[type="button"],
.ranking-legacy-filter input[type="button"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	min-height: 44px;
	min-width: 78px;
	padding: 0 18px 3px !important;
	box-sizing: border-box;
	text-align: center;
	border: 1px solid #aacce4 !important;
	border-bottom: 4px solid #84b1d0 !important;
	border-radius: 12px !important;
	background: linear-gradient(180deg, #ffffff 0%, #edf7fd 100%) !important;
	box-shadow:
		inset 0 2px 1px rgba(255,255,255,.95),
		0 4px 9px rgba(71,130,170,.13) !important;
	color: #3b6f96 !important;
	font-family: 'Grobold', 'Arial Black', sans-serif !important;
	font-size: 11px !important;
	font-weight: 400 !important;
	letter-spacing: .7px !important;
	text-transform: uppercase;
	text-shadow: 0 1px 0 #fff;
	cursor: pointer;
	transition: filter .15s ease, transform .08s ease, box-shadow .08s ease;
}

.ranking-filter-form input[type="submit"]:hover,
.ranking-legacy-filter input[type="submit"]:hover,
.ranking-filter-form input[type="button"]:hover,
.ranking-legacy-filter input[type="button"]:hover {
	filter: brightness(1.05);
	transform: translateY(-1px);
}

.ranking-filter-form input[type="submit"]:active,
.ranking-legacy-filter input[type="submit"]:active,
.ranking-filter-form input[type="button"]:active,
.ranking-legacy-filter input[type="button"]:active {
	transform: translateY(2px);
	border-bottom-width: 2px !important;
}

/* Existing ranking filter forms line up with the shared custom control.
   Keep the entire filter layer above ranking tables so an open custom dropdown
   can never be painted underneath a following table row. */
.ranking-filter-form,
.ranking-legacy-filter {
	position: relative !important;
	z-index: 1000 !important;
	overflow: visible !important;
}

.ranking-filter-form,
.ranking-legacy-filter p {
	align-items: center;
	justify-content: center;
	flex-wrap: nowrap !important;
	width: max-content;
	max-width: 100%;
	overflow: visible !important;
}

.ranking-filter-form .trival-select.is-open,
.ranking-legacy-filter .trival-select.is-open {
	z-index: 1100 !important;
}

.trival-select__menu {
	z-index: 1200;
}

.ranking-filter-form label,
.ranking-legacy-filter label {
	flex: 0 0 auto;
	white-space: nowrap;
}

.ranking-filter-form .trival-select,
.ranking-legacy-filter .trival-select,
.ranking-filter-form input[type="submit"],
.ranking-filter-form input[type="button"],
.ranking-legacy-filter input[type="submit"],
.ranking-legacy-filter input[type="button"] {
	flex: 0 0 auto;
}

/* Real button elements: exact optical centering for Grobold labels. */
.trival-filter-button {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	height: 44px !important;
	min-height: 44px !important;
	min-width: 82px !important;
	padding: 0 18px !important;
	box-sizing: border-box !important;
	border: 1px solid #2a93cf !important;
	border-bottom: 4px solid #1573b0 !important;
	border-radius: 12px !important;
	background: linear-gradient(180deg, #5cc3f5 0%, #34a8ef 48%, #1e90d8 100%) !important;
	box-shadow: inset 0 2px 1px rgba(255,255,255,.50), inset 0 -3px 6px rgba(0,70,120,.25), 0 4px 10px rgba(40,130,200,.24) !important;
	color: #fff !important;
	font-family: 'Grobold', 'Arial Black', sans-serif !important;
	font-size: 11.5px !important;
	font-weight: 400 !important;
	letter-spacing: .7px !important;
	line-height: 1 !important;
	text-align: center !important;
	text-decoration: none !important;
	text-shadow: 0 1px 2px rgba(0,60,110,.55) !important;
	text-transform: uppercase !important;
	white-space: nowrap !important;
	cursor: pointer;
	transition: filter .15s ease, transform .08s ease, box-shadow .08s ease;
}

.trival-filter-button__text {
	display: block;
	line-height: 1 !important;
	transform: translateY(2px);
	pointer-events: none;
}

.trival-filter-button--secondary {
	border-color: #aacce4 !important;
	border-bottom-color: #84b1d0 !important;
	background: linear-gradient(180deg, #ffffff 0%, #edf7fd 100%) !important;
	box-shadow: inset 0 2px 1px rgba(255,255,255,.95), 0 4px 9px rgba(71,130,170,.13) !important;
	color: #3b6f96 !important;
	text-shadow: 0 1px 0 #fff !important;
}

.trival-filter-button:hover {
	filter: brightness(1.05);
	transform: translateY(-1px);
	text-decoration: none !important;
}

.trival-filter-button:active {
	transform: translateY(2px);
	border-bottom-width: 2px !important;
}

@media (max-width: 700px) {
	.ranking-filter-form,
	.ranking-legacy-filter p {
		width: 100%;
		flex-wrap: wrap !important;
	}

	.trival-select {
		width: min(100%, 300px);
		min-width: 200px;
	}

	.trival-select__menu {
		max-height: 260px;
	}
}
