.aces-up {
	margin: 0 auto;
	max-width: 820px;
}

.aces-up .aces-up-body {
	background-color: green;
	padding: 10px;
	border-radius: 6px;
	max-height: 530px;
	height: 100vh;
	margin: 6px 0 30px;
}

.aces-up #table {
	display: grid;
	grid-template-rows: 1fr;
	grid-template-columns: 1fr 0.4fr 1fr 1fr 1fr 1fr 0.4fr 1fr;
	aspect-ratio: 8 / 1;
	gap: 0.6em;
	margin: 0 auto;
	max-width: 820px;
}

.aces-up #table>div {
	display: flex;
	justify-content: center;
	align-items: center;
}

.aces-up #stock {
	grid-area: 1/1/2/2;
}

.aces-up #pile1 {
	grid-area: 1/3/2/4;
}

.aces-up #pile2 {
	grid-area: 1/4/2/5;
}

.aces-up #pile3 {
	grid-area: 1/5/2/6;
}

.aces-up #pile4 {
	grid-area: 1/6/2/7;
}

.aces-up #waste {
	grid-area: 1/8/2/9;
}

.aces-up .pile {
	width: 100%;
	border-radius: 6%;
	border: 1px solid #333;
	user-select: none;
	position: relative;
	cursor: pointer;
	font-size: 40px;
	min-height: 160px;
}

.aces-up .card {
	width: 100%;
	height: 100%;
	display: inline-flex;
	justify-content: center;
	font-size: 20px;
	font-weight: bold;
	background-color: white;
	user-select: none;
	cursor: pointer;
	position: absolute;
}

.aces-up div.card {
	border-radius: 6%;
	border: 2px solid #000;
}

.aces-up img.card {
	width: 100%;
	border-radius: 6%;
	border: 1px solid #000;
}

.aces-up .card.selected {
	box-shadow: 0 0 10px 5px rgba(255, 0, 0, 0.5);
}

.aces-up .clubs {
	color: black;
}

.aces-up .diamonds {
	color: red;
}

.aces-up .hearts {
	color: red;
}

.aces-up .spades {
	color: black;
}

.aces-up .facedown {
	color: #80917b;
	background-color: #80917b;
}

.aces-up .game-over {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	justify-content: center;
	align-items: center;
	z-index: 1001;
	display: flex;
}

.aces-up .card-title {
	text-align: center;
	font-size: 1.6em;
}

.aces-up .game-over>div {
	background-color: white;
	padding: 20px;
	border-radius: 10px;
	text-align: center;
	color: black;
	width: 380px;
}

.aces-up .rules {
	margin-bottom: 4em;
}

.aces-up .rules h2 {
	line-height: 2em;
	font-size: 130%;
	font-weight: normal;
}

.aces-up .rules p {
	margin-bottom: 1em;
}

.aces-up .game-controls {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 10px 0;
	padding: 0 10px;
}

.aces-up .score-display {
	font-size: 18px;
	font-weight: bold;
	color: #333;
}

.aces-up .waste-pile {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	justify-content: center;
	align-items: center;
	min-height: 160px;
}

.aces-up .waste-card {
	width: 40px;
	height: 56px;
	border-radius: 6%;
	border: 1px solid #000;
	background-color: white;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 8px;
	font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
	.aces-up {
		max-width: 100%;
		padding: 0 10px;
	}
	
	.aces-up .aces-up-body {
		padding: 5px;
		max-height: 500px;
	}
	
	.aces-up #table {
		gap: 0.4em;
		aspect-ratio: 8 / 1;
	}
	
	.aces-up .pile {
		min-height: 120px;
		font-size: 30px;
	}
	
	.aces-up .card {
		font-size: 16px;
	}
	
	.aces-up .game-controls {
		flex-direction: column;
		gap: 10px;
		text-align: center;
	}
	
	.aces-up .score-display {
		font-size: 16px;
	}
}

@media (max-width: 600px) {
	.aces-up .game-button {
		font-size: .8em;
		padding: .1em .2em;
	}
	
	.aces-up #table {
		gap: 0.3em;
		aspect-ratio: 8 / 1;
	}
	
	.aces-up .pile {
		min-height: 80px;
		font-size: 24px;
	}
	
	.aces-up .card {
		font-size: 14px;
	}
	
	.aces-up .waste-card {
		width: 30px;
		height: 42px;
		font-size: 8px;
	}
}

@media (max-width: 480px) {
	.aces-up .aces-up-body {
		padding: 3px;
		max-height: 400px;
	}
	
	.aces-up #table {
		gap: 0.2em;
		aspect-ratio: 8 / 1;
	}
	
	.aces-up .pile {
		min-height: 60px;
		font-size: 20px;
	}
	
	.aces-up .card {
		font-size: 12px;
	}
	
	.aces-up .waste-card {
		width: 25px;
		height: 35px;
		font-size: 6px;
	}
}

/* Dark mode support */
body.dark .aces-up .aces-up-body {
	background-color: #1a4d1a;
}

body.dark .aces-up .pile {
	border-color: #666;
}

body.dark .aces-up .card {
	background-color: #333;
	color: #fff;
}

body.dark .aces-up .game-over>div {
	background-color: #333;
	color: #fff;
}

body.dark .aces-up .score-display {
	color: #ccc;
}

body.dark .aces-up .waste-card {
	background-color: #333;
	color: #fff;
	border-color: #666;
}
