/* GE-generated game HUD base. Games keep their own controls inside .ge-hud-specialty. */

/* C2-80M: GE HUD owns an isolated compositor layer independent from game panel canvases. */
.ge-hud-independent-layer {
	position:relative;
	z-index:2147483600 !important;
	isolation:isolate;
	contain:layout style paint;
	transform:translateZ(0);
	backface-visibility:hidden;
	will-change:transform;
	pointer-events:auto;
}

.ge-hud-host,
[data-ge-hud-host="true"] {
	z-index: 2147483600 !important;
	pointer-events: auto;
}
.ge-hud-base {
	position: relative;
	z-index: 2147483600 !important;
}
#rankingsOverlay {
	z-index: 2147483300 !important;
}
#ge-overlay-clean-root {
	z-index: 2147483400 !important;
}
.ge-hud-base {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    pointer-events: auto;
}
.ge-hud-core,
.ge-hud-specialty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ge-hud-core {
    order: -1000;
}
.ge-hud-specialty {
    min-width: 0;
}
.ge-hud-button,
.ge-hud-badge,
.ge-hud-base button.ge-hud-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 4px 9px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.30);
    background: rgba(0,0,0,.56);
    color: #fff;
    font: 12px/1.2 system-ui, -apple-system, Segoe UI, sans-serif;
    white-space: nowrap;
    box-sizing: border-box;
}
.ge-hud-button { cursor: pointer; }
.ge-hud-button:hover { background: rgba(32,32,32,.72); }
.ge-hud-button:active { transform: translateY(1px); }
.ge-hud-button:disabled,
.ge-hud-base button.ge-hud-button:disabled {
	opacity: .58;
	cursor: wait;
	transform: none;
}
.ge-hud-badge { cursor: default; }

/* Shared GE HUD toggle feedback. */
.ge-hud-button.ge-hud-press-bump,
.ge-hud-base button.ge-hud-button.ge-hud-press-bump,
#gamepadOverlayToggle.ge-hud-press-bump,
#rankingsToggle.ge-hud-press-bump {
	animation: geHudPressBump 150ms ease-out;
}
@keyframes geHudPressBump {
	0% { transform: translateY(0) scale(1); }
	45% { transform: translateY(1px) scale(0.96); }
	100% { transform: translateY(0) scale(1); }
}
.ge-hud-button[aria-pressed="true"],
.ge-hud-base button.ge-hud-button[aria-pressed="true"],
#gamepadOverlayToggle[aria-pressed="true"],
#rankingsToggle[aria-pressed="true"] {
	background: #064fc4 !important;
	background-color: #064fc4 !important;
	border-color: rgba(120, 190, 255, 0.95) !important;
	color: #ffffff !important;
	box-shadow: 0 0 8px rgba(0, 102, 255, 0.75) !important;
	outline: 1px solid rgba(190, 225, 255, 0.95);
	outline-offset: 1px;
}
.ge-hud-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    flex: 0 0 auto;
}
.ge-hud-refresh-icon {
    font-size: 18px;
    line-height: 1;
}

/* GE-HUD owns the generated controls even when mounted inside short legacy HUD bars. */
#hud.ge-hud-host,
#hud[data-ge-hud-host="true"],
#topRight.ge-hud-host,
#topRight[data-ge-hud-host="true"],
.ge-hud-host,
[data-ge-hud-host="true"] {
	overflow: visible !important;
	pointer-events: auto !important;
}
#hud .ge-hud-base,
#topRight .ge-hud-base {
	min-height: 30px;
}
#hud .ge-hud-button,
#hud .ge-hud-badge,
#hud .ge-hud-gamepad-status,
#hud .ge-hud-base button.ge-hud-button,
#topRight .ge-hud-button,
#topRight .ge-hud-badge,
#topRight .ge-hud-gamepad-status,
#topRight .ge-hud-base button.ge-hud-button {
	height: auto !important;
	min-height: 30px !important;
	line-height: 1.2 !important;
	padding: 4px 9px !important;
}

#gamepad-overlay-config-source,
#gamepad-debug-overlay-control-dock {
    display: none !important;
}
#topRight .ge-hud-base {
    justify-content: flex-end;
}
#topRight .ge-hud-core,
#topRight .ge-hud-specialty {
    justify-content: flex-end;
}
@media (max-width: 700px) {
    .ge-hud-base { gap: 5px; }
    .ge-hud-core, .ge-hud-specialty { gap: 5px; }
    .ge-hud-button, .ge-hud-badge, .ge-hud-base button.ge-hud-button {
        min-height: 28px;
        padding: 3px 6px;
        font-size: 11px;
    }
    .ge-hud-icon { width: 18px; height: 18px; }
}

.ge-hud-gamepad-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 9px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.30);
    background: rgba(90,40,0,.62);
    color: #fff;
    font: 12px/1.2 system-ui, -apple-system, Segoe UI, sans-serif;
    white-space: nowrap;
    box-sizing: border-box;
}
.ge-hud-gamepad-status[hidden],
.ge-hud-gamepad-status.ge-gamepad-detected {
    display: none !important;
}
/* Legacy game-local "Gamepad Not Detected" overlays are suppressed; GE-HUD owns this status. */
.pzlm-gamepad-overlay {
    display: none !important;
}
/* GE Rankings: wide, exact-config table. */
#rankingsPanel,
[data-ge-rankings-panel="true"] {
	width: min(1180px, 96vw) !important;
	max-width: 96vw !important;
	max-height: 88vh !important;
	box-sizing: border-box;
}
#rankingsBody,
#rankingsBody table,
.ge-rankings-table {
	max-width: 100%;
}
#rankingsBody {
	overflow-x: auto;
}
.ge-rankings-controls {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, max-content));
	gap: 8px 16px;
	align-items: start;
	margin: 0 0 12px;
}
.ge-rankings-filter-label {
	display: grid;
	grid-template-rows: auto auto;
	gap: 3px;
	font-weight: 700;
	width: 220px;
}
.ge-rankings-filter,
.ge-rankings-difficulty-select,
.ge-rankings-table-select {
	box-sizing: border-box;
	width: 220px;
	max-width: min(320px, 86vw);
	padding: 4px 6px;
	border-radius: 6px;
}
#rankingsPanel table:not(.ge-rankings-table) {
	width: 100%;
	border-collapse: collapse;
}
.ge-rankings-table {
	width: auto;
	min-width: 0;
	border-collapse: collapse;
	table-layout: auto;
}
.ge-rankings-table th,
.ge-rankings-table td {
	padding: 4px 8px;
	vertical-align: top;
	white-space: nowrap;
}
.ge-rankings-table th:nth-child(5),
.ge-rankings-table td:nth-child(5),
.ge-rankings-table th:nth-child(6),
.ge-rankings-table td:nth-child(6),
.ge-rankings-table th:nth-child(7),
.ge-rankings-table td:nth-child(7) {
	white-space: normal;
	overflow-wrap: anywhere;
}
@media (max-width: 700px) {
	#rankingsPanel,
	[data-ge-rankings-panel="true"] {
		width: 98vw !important;
		padding: 12px !important;
	}
	.ge-rankings-table th,
	.ge-rankings-table td {
		padding: 3px 5px;
	}
}

/* Universal GE Rankings format. */
#rankingsPanel,
[data-ge-rankings-panel="true"] {
	position: relative;
}
.ge-rankings-close-x,
#rankingsClose.ge-rankings-close-x {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	min-width: 28px;
	min-height: 28px;
	padding: 2px 8px;
	border-radius: 7px;
	border: 1px solid rgba(255,255,255,.45);
	background: rgba(0,0,0,.68);
	color: #fff;
	font: 700 14px/1 system-ui, -apple-system, Segoe UI, sans-serif;
	cursor: pointer;
}
.ge-rankings-heading {
	margin: 0 36px 12px 0;
	font-size: 18px;
	line-height: 1.25;
}
.ge-rankings-table th:nth-child(1),
.ge-rankings-table td:nth-child(1),
.ge-rankings-table th:nth-child(2),
.ge-rankings-table td:nth-child(2),
.ge-rankings-table th:nth-child(3),
.ge-rankings-table td:nth-child(3),
.ge-rankings-table th:nth-child(4),
.ge-rankings-table td:nth-child(4),
.ge-rankings-table th:nth-child(7),
.ge-rankings-table td:nth-child(7) {
	width: 1%;
}
.ge-rankings-table th:nth-child(5),
.ge-rankings-table td:nth-child(5) {
	width: 1%;
	max-width: 14rem;
	white-space: normal;
	overflow-wrap: anywhere;
}
.ge-rankings-table th:nth-child(6),
.ge-rankings-table td:nth-child(6) {
	width: 1%;
	max-width: 18rem;
	white-space: normal;
	overflow-wrap: anywhere;
}
.ge-rankings-table th:nth-child(7),
.ge-rankings-table td:nth-child(7) {
	white-space: nowrap;
}
.ge-rankings-table td.ge-rankings-entry-number {
	text-align: left;
	font-variant-numeric: tabular-nums;
}
.ge-rankings-entry-number-inner {
	display: inline-block;
	min-width: var(--ge-rankings-cell-ch, 1ch);
	text-align: right;
}

/* GE Rankings compact fixed-content table columns. */
#rankingsBody .ge-rankings-table {
	display: inline-table !important;
	width: max-content !important;
	min-width: 0 !important;
	max-width: none !important;
	table-layout: auto !important;
}
#rankingsBody .ge-rankings-table th,
#rankingsBody .ge-rankings-table td {
	width: auto !important;
	max-width: none !important;
	padding: 4px 14px 4px 8px;
	white-space: nowrap !important;
	overflow-wrap: normal !important;
	text-align: left;
}
#rankingsBody .ge-rankings-table th:last-child,
#rankingsBody .ge-rankings-table td:last-child {
	padding-right: 8px;
}
#rankingsBody .ge-rankings-table td.ge-rankings-entry-number {
	text-align: left;
}
#rankingsBody .ge-rankings-entry-number-inner {
	display: inline-block;
	min-width: var(--ge-rankings-cell-ch, 1ch);
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* GE Rankings best-fit text scaling. */
#rankingsBody {
	--ge-rankings-fit-scale: 1;
}
#rankingsBody .ge-rankings-fit-box {
	display: inline-block;
	max-width: none;
	transform-origin: left top;
}
#rankingsBody.ge-rankings-text-fit-active .ge-rankings-fit-box {
	line-height: 1.25;
}
#rankingsBody.ge-rankings-text-fit-active .ge-rankings-table th,
#rankingsBody.ge-rankings-text-fit-active .ge-rankings-table td {
	padding-left: .45em;
	padding-right: .75em;
}
