:root {
		--primary: #3b82f6;
		--primary-light: rgba(59, 130, 246, 0.2);
		--primary-dark: #2563eb;
		--card-bg: white;
		--text-primary: #1e293b;
		--text-secondary: #64748b;
		--border-color: #e2e8f0;
		--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
		--transition: all 0.3s ease;
	}

	.dark {
		--primary: #60a5fa;
		--primary-light: rgba(96, 165, 250, 0.2);
		--primary-dark: #3b82f6;
		--card-bg: #1e293b;
		--text-primary: #f8fafc;
		--text-secondary: #94a3b8;
		--border-color: #334155;
		--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
	}

	* {
		margin: 0;
		padding: 0;
		box-sizing: border-box;
		font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	}

	body {
		color: var(--text-primary);
		transition: var(--transition);
		min-height: 100vh;
		padding: 20px 0;
	}

	.dark body {
		background-color: #0f172a;
	}

	.container {
		max-width: 800px;
		margin: 0 auto;
		padding: 0 20px;
	}

	.app-header {
		text-align: center;
		margin-bottom: 30px;
		padding-top: 25px;
		position: relative;
	}

	.app-title {
		font-size: 2.5rem;
		margin-bottom: 10px;
		background: linear-gradient(90deg, var(--primary), #8b5cf6);
		-webkit-background-clip: text;
		background-clip: text;
		color: transparent;
	}

	.app-subtitle {
		color: var(--text-secondary);
		font-size: 1.08rem;
	}

	.meal-selector {
		background-color: var(--card-bg);
		border-radius: 12px;
		display: flex;
		overflow: hidden;
		box-shadow: var(--shadow);
		margin-bottom: 25px;
		position: relative;
	}

	.meal-option {
		flex: 1; /* 改为三等分 */
		padding: 16px;
		text-align: center;
		cursor: pointer;
		transition: var(--transition);
		z-index: 1;
		font-weight: 500;
	}

	.meal-option.active {
		color: white;
	}

	.meal-indicator {
		position: absolute;
		height: 100%;
		width: 33.333%; /* 改为三分之一宽度 */
		background-color: var(--primary);
		border-radius: 12px;
		transition: var(--transition);
	}

	.meal-indicator.breakfast {
		left: 0;
	}

	.meal-indicator.dinner {
		left: 33.333%; /* 中间位置 */
	}

	.meal-indicator.snack {  
		left: 66.666%; /* 右侧位置 */
	}

	.food-card {
		background-color: var(--card-bg);
		border-radius: 16px;
		padding: 30px;
		text-align: center;
		box-shadow: var(--shadow);
		margin-bottom: 25px;
		position: relative;
		overflow: hidden;
	}

	.food-display {
		min-height: 180px;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		position: relative;
	}

	.food-emoji {
		font-size: 5rem;
		margin-bottom: 15px;
		margin-top: 1px;
		transition: transform 0.3s ease;
	}

	.food-name {
		font-size: 2rem;
		font-weight: 600;
		margin-bottom: 10px;
		transition: var(--transition);
	}

	.food-description {
		color: var(--text-secondary);
		font-size: 1.1rem;
		max-width: 500px;
	}

	.decide-btn {
		background-color: var(--primary);
		color: white;
		border: none;
		border-radius: 30px;
		padding: 14px 32px;
		font-size: 1.1rem;
		font-weight: 500;
		cursor: pointer;
		transition: var(--transition);
		margin-top: 20px;
		display: inline-flex;
		align-items: center;
		gap: 8px;
		box-shadow: 
			0 4px 12px rgba(59, 130, 246, 0.25),
			0 1px 3px rgba(59, 130, 246, 0.1);
		position: relative;
		overflow: hidden;
		transform: translateY(0);
		transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* 更自然的弹性过渡 */
	}

	.decide-btn::after {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.15);
		border-radius: inherit;
		pointer-events: none;
	}
	
	.decide-btn:hover {
		background-color: var(--primary-dark);
		transform: translateY(-2px);
		box-shadow: 
			0 6px 16px rgba(59, 130, 246, 0.3),
			0 2px 4px rgba(59, 130, 246, 0.15);
		transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
	}
	
	.decide-btn:active {
		transform: translateY(3px);
		box-shadow: 
			0 2px 8px rgba(59, 130, 246, 0.15),
			inset 0 1px 2px rgba(0, 0, 0, 0.1); 
			transition: all 0.1s ease; /* 快速过渡增强响应感 */
	}

	.decide-btn:disabled {
		background-color: var(--text-secondary);
		cursor: not-allowed;
		transform: none;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	}
	
	/* 调整骰子按钮图标大小 */
	.decide-btn i {
		font-size: 1.5rem;
	}

	.food-scroll-container {
		background-color: var(--card-bg);
		border-radius: 16px;
		padding: 1px 10px;
		box-shadow: var(--shadow);
		overflow: hidden;
		margin: 10px 0 25px;
		position: relative;
	}

	.food-scroll-track {
		display: flex;
		gap: 15px;
		padding: 10px 0;
		animation: scrollFood 8s linear infinite;
	}

	.food-scroll-track:hover {
		animation-play-state: paused;
	}

	.food-scroll-item {
		background-color: rgba(59, 130, 246, 0.1);
		border-radius: 20px;
		padding: 8px 16px;
		white-space: nowrap;
		font-size: 0.9rem;
		transition: var(--transition);
	}

	.food-scroll-item:hover {
		background-color: var(--primary-light);
		transform: scale(1.05);
	}

	/* 食物库管理按钮样式 */
	.manage-btn {
		background-color: transparent;
		color: var(--primary);
		border: 1px solid var(--primary);
		padding: 8px 20px;
		border-radius: 30px;
		font-size: 0.9rem;
		cursor: pointer;
		transition: var(--transition);
		margin: 15px auto 0;
		display: block;
	}

	.manage-btn:hover {
		background-color: var(--primary);
		color: white;
	}

	/* 食物库管理模态框样式 */
	.modal-overlay {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 2000;
		opacity: 0;
		visibility: hidden;
		transition: var(--transition);
	}

	.modal-overlay.show {
		opacity: 1;
		visibility: visible;
	}

	.modal-container {
		background-color: var(--card-bg);
		border-radius: 16px;
		width: 90%;
		max-width: 600px;
		max-height: 90vh;
		display: flex;
		flex-direction: column;
		transform: translateY(-20px);
		transition: transform 0.3s ease;
	}

	.modal-overlay.show .modal-container {
		transform: translateY(0);
	}

	.modal-header {
		padding: 20px 25px;
		border-bottom: 1px solid var(--border-color);
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.modal-title {
		font-size: 1.2rem;
		font-weight: 600;
		display: flex;
		align-items: center;
		gap: 8px;
	}

	.close-modal {
		background: none;
		border: none;
		font-size: 1.5rem;
		color: var(--text-secondary);
		cursor: pointer;
		transition: var(--transition);
	}

	.close-modal:hover {
		color: var(--text-primary);
	}

	.modal-body {
		padding: 25px;
		overflow-y: auto;
		flex: 1;
	}

	.modal-footer {
		padding: 15px 25px;
		border-top: 1px solid var(--border-color);
		text-align: right;
	}

	/* 模态框内的食物管理样式 */
	.add-food-form {
		display: flex;
		gap: 10px;
		margin-bottom: 25px;
		align-items: center;
	}

	.food-input {
		flex: 2; /* 减小食物输入框的占比 */
		padding: 12px 18px;
		border: 1px solid var(--border-color);
		border-radius: 30px;
		background-color: transparent;
		color: var(--text-primary);
		transition: var(--transition);
	}

	.food-input:focus {
		outline: none;
		border-color: var(--primary);
		box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
	}

	.food-type-select {
		flex: 1.5; /* 增加类型选择框的占比 */
		padding: 12px 18px;
		border: 1px solid var(--border-color);
		border-radius: 30px;
		background-color: transparent;
		color: var(--text-primary);
		transition: var(--transition);
		text-align: center;
	}

	.add-btn {
		background-color: var(--primary);
		color: white;
		border: none;
		border-radius: 30px;
		padding: 12px 20px;
		min-width: 80px;
		height: 46px;
		cursor: pointer;
		transition: var(--transition);
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 1.2rem;
		font-weight: bold;
	}

	.add-btn i {
		font-size: 1.4rem; 
		}

	.add-btn:hover {
		background-color: var(--primary-dark);
	}

	.custom-food-list {
		max-height: 200px;
		overflow-y: auto;
		padding-right: 10px;
	}

	.custom-food-item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 12px 15px;
		border-radius: 10px;
		background-color: rgba(0, 0, 0, 0.03);
		margin-bottom: 10px;
		transition: var(--transition);
	}

	.custom-food-item:hover {
		background-color: rgba(0, 0, 0, 0.05);
	}

	.custom-food-item.preset {
		opacity: 0.9;
	}

	.food-item-type {
		font-size: 0.75rem;
		padding: 3px 10px;
		border-radius: 20px;
		background-color: var(--primary-light);
		color: var(--primary-dark);
		margin-right: 10px;
	}

	.food-item-source {
		font-size: 0.7rem;
		padding: 2px 8px;
		border-radius: 20px;
		background-color: rgba(0, 0, 0, 0.1);
		color: var(--text-secondary);
		margin-right: 10px;
	}

	.food-actions {
		display: flex;
		gap: 5px;
	}

	.edit-btn, .delete-btn {
		background: none;
		border: none;
		color: var(--text-secondary);
		cursor: pointer;
		transition: var(--transition);
		padding: 5px;
	}

	.edit-btn:hover {
		color: var(--primary);
	}

	.delete-btn:hover {
		color: #ef4444;
	}

	/* 编辑食物模态框样式 */
	.edit-modal {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 2010;
		opacity: 0;
		visibility: hidden;
		transition: var(--transition);
	}

	.edit-modal.show {
		opacity: 1;
		visibility: visible;
	}

	.edit-modal-content {
		background-color: var(--card-bg);
		border-radius: 16px;
		padding: 25px;
		width: 90%;
		max-width: 400px;
		transform: translateY(-20px);
		transition: transform 0.3s ease;
	}

	.edit-modal.show .edit-modal-content {
		transform: translateY(0);
	}

	/* 调整编辑模态框按钮布局 */
	.edit-modal-content .modal-footer {
		display: flex;
		justify-content: space-between;
		margin-top: 15px;
	}

	.toast {
		position: fixed;
		bottom: 20px;
		left: 50%;
		transform: translateX(-50%) translateY(100px);
		background-color: var(--text-primary);
		color: white;
		padding: 10px 20px;
		border-radius: 30px;
		box-shadow: var(--shadow);
		transition: transform 0.3s ease;
		z-index: 3000;
	}

	.toast.show {
		transform: translateX(-50%) translateY(0);
	}

	@keyframes scrollFood {
		to {
			transform: translateX(var(--scroll-distance));
		}
	}

	@keyframes bounce {
		0%, 100% { transform: translateY(0); }
		50% { transform: translateY(-10px); }
	}

	@media (max-width: 576px) {
		.app-title {
			font-size: 2rem;
		}
		
		.app-subtitle {
			font-size: 1rem;
		}
		
		.food-emoji {
			font-size: 4rem;
		}
		
		.food-name {
			font-size: 1.5rem;
		}
		
		/* 优化食物库管理模态框整体适配 */
		.modal-container {
			width: 95%; 
			max-height: 95vh; 
			margin: 0 auto;
		}
		
		.modal-header {
			padding: 15px 20px;
			font-size: 1.1rem; 
		}
		
		.modal-body {
			padding: 20px 15px; 
			max-height: calc(95vh - 120px); 
			font-size: 1rem; 
		}
		
		.modal-footer {
			padding: 12px 15px;
		}
		
		.add-food-form {
			display: flex;
			flex-wrap: wrap; /* 自动换行，不强制垂直 */
			gap: 10px; /* 合理间距 */
			align-items: center;
		}
		
		.food-input {
			flex: 1; /* 输入框占剩余宽度 */
			min-width: 120px; /* 最小宽度，避免过窄 */
			padding: 10px 15px;
			height: 48px;
			font-size: 1rem; /* 调大输入框字体 */
		}
		
		.food-type-select {
			flex: 0.8; /* 增加类型选择框的占比 */
			width: 100px; /* 固定宽度，避免挤压 */
			text-align: center !important;
			text-align-last: center !important;
			padding: 10px 10px;
			height: 48px;
			font-size: 0.95rem; /* 调大选择框字体 */
		}
		
		.add-btn {
			width: 100%; /* 按钮全屏宽（单独一行） */
			height: 48px;
			font-size: 1.2rem; /* 调大按钮字体/图标 */
			margin-top: 5px;
		}
		
		/* 调大食物列表字体和操作按钮 */
		.custom-food-item {
			padding: 12px 15px;
			font-size: 1rem; /* 调大食物名称字体 */
		}
		
		.food-item-type, .food-item-source {
			font-size: 0.85rem; /* 调大标签字体 */
			padding: 4px 12px; /* 调大标签触控区域 */
		}
		
		/* 调大编辑/删除按钮尺寸和图标 */
		.edit-btn, .delete-btn {
			padding: 8px; /* 增大触控区域 */
			font-size: 1.2rem; /* 调大图标尺寸 */
		}
		
		/* 优化编辑模态框手机端适配 */
		.edit-modal-content {
			width: 95%;
			padding: 20px 15px;
			font-size: 1rem; /* 调大编辑模态框字体 */
		}
		
		/* 优化手机端三个餐类型选项的样式 */
		.meal-option {
			font-size: 0.9rem;
			padding: 12px 8px;
		}
		
		/* 优化管理按钮在手机端的尺寸 */
		.manage-btn {
			padding: 10px 25px;
			font-size: 1rem;
		}
		
		/* 修复编辑模态框按钮在手机端的布局 */
		.edit-modal-content .modal-footer {
			flex-direction: row;
			gap: 10px;
		}
		
		.cancel-btn, .save-btn {
			flex: 1; /* 按钮平分宽度 */
			padding: 10px 0; /* 增大按钮触控区域 */
			font-size: 1rem; /* 调大按钮字体 */
			text-align: center;
		}
	}
	
/* 统一的头部按钮样式 */
.header-btn {
	position: absolute;
	top: 0px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: var(--transition);
	text-decoration: none;
	border: 1px solid var(--primary);
	color: var(--primary);
	background: rgba(255, 255, 255, 0.1);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	backdrop-filter: blur(10px);
}

.header-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
	background: rgba(59, 130, 246, 0.1);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transform: translateY(-1px);
}

.dark .header-btn {
	background: rgba(30, 41, 59, 0.3);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-toggle { left: 0; }
.sound-toggle { left: 44px; } /* 新增sound按钮的位置 */
.back-home-btn { right: 0; }

/* 分别设置左右位置 */
.theme-toggle {
	left: 0;
}
.sound-toggle { left: 44px; } 

.back-home-btn {
	right: 0;
}


/* 编辑模态框表单容器  */
.edit-form-container {
	display: flex; /* 启用Flex布局 */
	gap: 15px; /* 两个框之间的间距（可调整） */
	margin-top: 15px; 
	margin-bottom: 15px; /* 与下方按钮的间距 */
}

/* 输入框和选择框自适应宽度 */
#editFoodInput, #editFoodTypeSelect {
	flex: 1; /* 平均分配可用空间 */
	width: 0; /* 配合flex:1实现完全自适应 */
	text-align: center;
}

/* 移除选择框原有的顶部margin，避免垂直错位 */
#editFoodTypeSelect {
	margin-top: 0 !important;
}

/* 确保移动设备上依然保持一行布局 */
@media (max-width: 576px) {
	.edit-form-container {
		margin-top: 15px; /* 增加顶部间距，使其不贴紧上方线条 */
		margin-bottom: 20px; /* 适当增加底部间距，保持整体平衡 */
	}
	
	/* 确保输入框和选择框内部文字垂直居中 */
	#editFoodInput, #editFoodTypeSelect {
		padding-top: 12px;
		padding-bottom: 12px;
		height: auto; /* 让高度由内边距自然撑开 */
	}
}

.food-card.glow {
	box-shadow:
		0 0 0 2px rgba(59,130,246,.4),
		0 0 28px rgba(59,130,246,.35);
}

.food-card.rolling {
	box-shadow:
		0 0 0 1px rgba(59,130,246,.25),
		0 12px 40px rgba(0,0,0,.15);
}
