#menu-screen {
	align-items: center;
	justify-content: center;
}

.menu-container {
	width: min(640px, 100%);
	display: flex;
	flex-direction: column;
	gap: 16px;
	background: rgba(20, 23, 31, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 20px;
	padding: 22px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
	position: relative;
	overflow: hidden;
}

.menu-container > * {
	position: relative;
	z-index: 1;
}

.menu-title {
	margin: -4px 0 6px;
	font-size: clamp(2rem, 4vw, 2.6rem);
	text-align: center;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent-light);
}

.loadout-header {
	position: relative;
	display: block;
	width: 100%;
	padding-right: clamp(56px, 22vw, 92px);
	min-height: 1.6em;
}

.menu-heading {
	margin: 0 0 8px;
	font-size: 1rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(244, 247, 255, 0.6);
}

.menu-logo {
	position: absolute;
	top: 50%;
	right: 0;
	width: clamp(48px, 18vw, 84px);
	height: auto;
	transform: translateY(-62%);
	object-fit: contain;
	filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
	opacity: 0.9;
	pointer-events: none;
}

.loadout-section {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.speed-selector-container {
	position: relative;
	margin-bottom: 10px;
}

.speed-toggle {
	width: 100%;
	height: 34px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 10px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(15, 17, 25, 0.8);
	color: var(--text);
	cursor: pointer;
	font-size: 0.9rem;
	transition: all 0.15s ease;
}

.speed-toggle:hover {
	background: rgba(20, 23, 31, 0.9);
	border-color: rgba(255, 255, 255, 0.15);
}

.speed-toggle-label {
	color: rgba(244, 247, 255, 0.75);
}

.speed-toggle-label #speed-display {
	color: var(--accent-light);
	font-weight: 500;
}

.speed-toggle-arrow {
	color: rgba(244, 247, 255, 0.5);
	font-size: 0.7rem;
	transition: transform 0.2s ease;
}

.speed-toggle.open .speed-toggle-arrow {
	transform: rotate(180deg);
}

.speed-options-dropdown {
	position: absolute;
	bottom: calc(100% + 4px);
	left: 0;
	right: 0;
	background: rgba(15, 17, 25, 0.95);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	overflow: hidden;
	z-index: 100;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.speed-options-dropdown.hidden {
	display: none;
}

.speed-option-compact {
	display: flex;
	align-items: center;
	padding: 8px 10px;
	cursor: pointer;
	transition: background 0.1s ease;
}

.speed-option-compact:hover {
	background: rgba(255, 255, 255, 0.06);
}

.speed-option-compact.selected {
	background: rgba(124, 92, 255, 0.15);
}

.speed-option-compact input[type="radio"] {
	display: none;
}

.speed-option-compact span {
	color: rgba(244, 247, 255, 0.9);
	font-size: 0.9rem;
}

.loadout-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 8px;
}

.loadout-card {
	height: auto;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	padding: 10px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid transparent;
	text-align: left;
	min-height: 120px;
}

.loadout-card .loadout-icon {
	font-size: 1.8rem;
}

.loadout-name {
	font-size: 1.1rem;
	font-weight: 600;
}

.loadout-description {
	color: rgba(244, 247, 255, 0.7);
	font-size: 0.9rem;
}

.loadout-card.selected {
	border-color: var(--accent);
	box-shadow: 0 0 24px rgba(124, 92, 255, 0.35);
}

.loadout-card.disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.menu-connection {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.menu-buttons {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.menu-join {
	display: flex;
	gap: 6px;
}

.menu-status {
	min-height: 20px;
	font-size: 0.95rem;
	color: rgba(244, 247, 255, 0.75);
}

input[type="text"] {
	height: 34px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(15, 17, 25, 0.8);
	color: var(--text);
	padding: 0 8px;
	width: 88px;
	text-transform: uppercase;
}

input[type="text"]::placeholder {
	color: rgba(255, 255, 255, 0.35);
}

.host-confirm-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	backdrop-filter: blur(4px);
}

.host-confirm-overlay.hidden {
	display: none;
}

.host-confirm-dialog {
	width: min(420px, 90%);
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 24px;
	background: rgba(20, 23, 31, 0.98);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 16px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.host-confirm-btn {
	height: 48px;
	border-radius: 10px;
	border: 2px solid var(--accent);
	background: var(--accent);
	color: var(--text);
	font-size: 1.05rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.host-confirm-btn:hover {
	background: var(--accent-light);
	border-color: var(--accent-light);
	box-shadow: 0 4px 16px rgba(124, 92, 255, 0.4);
	transform: translateY(-1px);
}

.host-confirm-btn:active {
	transform: translateY(0);
}

.host-confirm-info {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 8px 0;
}

.host-confirm-title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--text);
	text-align: center;
}

.host-confirm-text {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.5;
	color: rgba(244, 247, 255, 0.75);
	text-align: center;
}

.host-confirm-cancel {
	height: 40px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.15);
	background: rgba(255, 255, 255, 0.05);
	color: rgba(244, 247, 255, 0.8);
	font-size: 0.95rem;
	cursor: pointer;
	transition: all 0.15s ease;
}

.host-confirm-cancel:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.25);
}

/* Loadout carousel wrapper */
.loadout-carousel-wrapper {
	position: relative;
	width: 100%;
}

/* Pagination dots */
.loadout-dots {
	display: none; /* Hidden on desktop */
	justify-content: center;
	gap: 8px;
	margin-top: 16px;
}

.loadout-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	cursor: pointer;
}

.loadout-dot.active {
	width: 24px;
	border-radius: 4px;
	background: var(--accent);
	box-shadow: 0 0 12px rgba(124, 92, 255, 0.5);
}

@media (max-width: 480px) {
	.menu-container {
		padding: 16px;
		gap: 12px;
	}

	/* Transform grid into horizontal carousel */
	.loadout-carousel-wrapper {
		margin: 0 -16px; /* Extend to edges */
		padding: 0 16px;
		overflow: visible;
	}

	.loadout-grid {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scroll-behavior: smooth;
		gap: 12px;
		padding: 8px 0 16px;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none; /* Firefox */
		-ms-overflow-style: none; /* IE/Edge */
	}

	.loadout-grid::-webkit-scrollbar {
		display: none; /* Chrome/Safari */
	}

	.loadout-card {
		flex: 0 0 calc(100% - 64px);
		scroll-snap-align: center;
		scroll-snap-stop: always;
		padding: 20px;
		min-height: 160px;
		gap: 10px;
		border-radius: 20px;
		background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
		border: 2px solid rgba(255, 255, 255, 0.08);
		box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
		transform: scale(0.92);
		opacity: 0.5;
		transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
		position: relative;
		overflow: hidden;
	}

	/* Animated gradient background */
	.loadout-card::before {
		content: '';
		position: absolute;
		top: -50%;
		left: -50%;
		width: 200%;
		height: 200%;
		background: radial-gradient(circle, rgba(124, 92, 255, 0.1) 0%, transparent 70%);
		opacity: 0;
		transition: opacity 0.4s ease;
		pointer-events: none;
	}

	.loadout-card.selected::before {
		opacity: 1;
	}

	/* Center card is active */
	.loadout-card.selected {
		transform: scale(1);
		opacity: 1;
		border-color: var(--accent);
		box-shadow:
			0 0 40px rgba(124, 92, 255, 0.4),
			0 12px 48px rgba(0, 0, 0, 0.5),
			inset 0 1px 0 rgba(255, 255, 255, 0.1);
		background: linear-gradient(135deg, rgba(124, 92, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
	}

	.loadout-card .loadout-icon {
		font-size: 3rem;
		line-height: 1;
		filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
		transform: scale(1);
		transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	}

	.loadout-card.selected .loadout-icon {
		transform: scale(1.1);
		filter: drop-shadow(0 6px 16px rgba(124, 92, 255, 0.4));
	}

	.loadout-name {
		font-size: 1.25rem;
		line-height: 1.2;
		font-weight: 700;
		letter-spacing: 0.02em;
		color: rgba(244, 247, 255, 0.7);
		transition: color 0.4s ease;
	}

	.loadout-card.selected .loadout-name {
		color: var(--text);
		text-shadow: 0 2px 8px rgba(124, 92, 255, 0.3);
	}

	.loadout-description {
		font-size: 0.9rem;
		line-height: 1.4;
		margin-top: auto;
		color: rgba(244, 247, 255, 0.5);
		transition: color 0.4s ease;
	}

	.loadout-card.selected .loadout-description {
		color: rgba(244, 247, 255, 0.8);
	}

	/* Show pagination dots on mobile */
	.loadout-dots {
		display: flex;
	}

	.menu-connection,
	.menu-buttons {
		gap: 8px;
	}

	.speed-toggle {
		height: 32px;
		padding: 0 8px;
	}

	.menu-join {
		flex-direction: column;
		gap: 6px;
	}

	input[type="text"] {
		width: 100%;
	}

	.host-confirm-dialog {
		padding: 20px;
		gap: 16px;
	}

	.host-confirm-title {
		font-size: 1.05rem;
	}

	.host-confirm-text {
		font-size: 0.9rem;
	}
}
