/* Target the board section specifically to override Bootstrap classes */
section.board,
#mainGameBoard.board,
#mainGameBoard {
	min-height: 50vh !important; /* Half viewport height with !important */
	height: auto !important; /* Force height */
	display: flex !important;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: center; /* Center the cards */
	gap: 18px; /* Space between cards */
	padding: 16px; /* Add padding around the board */
	background-color: #f8f9fa !important; /* Light background to make it visible */
	border: 3px solid #007bff !important; /* Blue border to make it very visible */
	position: relative; /* Ensure proper positioning */
	overflow: visible; /* Allow content to be visible */
	margin: 20px 0; /* Add margin for visibility */
	box-sizing: border-box; /* Include border in height calculation */
}

.at_card {
	width: clamp(145px, 22vw, 220px);
	aspect-ratio: 3 / 4;
	flex: 0 0 auto;
	perspective: 900px;
	cursor: pointer;
	outline: none;
}

.at_card_inner {
	width: 100%;
	height: 100%;
	position: relative;
	transform-style: preserve-3d;
	transition: transform 560ms cubic-bezier(0.21, 0.75, 0.2, 1);
}

.at_card--revealed .at_card_inner {
	transform: rotateY(180deg);
}

.at_card_face {
	position: absolute;
	inset: 0;
	display: flex;
	border-radius: 12px;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.at_card_back {
	align-items: center;
	justify-content: center;
	font-size: clamp(2.2rem, 6vw, 3.1rem);
	font-weight: 700;
	color: #f8fafc;
	background:
		radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.14) 0 16%, transparent 17%),
		radial-gradient(circle at 82% 78%, rgba(255, 255, 255, 0.12) 0 14%, transparent 15%),
		linear-gradient(160deg, #0f4c75 0%, #1b262c 100%);
	border: 2px solid #0f4c75;
}

.at_card_front {
	background: linear-gradient(160deg, #ffffff 0%, #eef3ff 100%);
	border: 2px solid #90b4f8;
	transform: rotateY(180deg);
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 12px;
	gap: 8px;
}

.at_card_emoji {
	font-size: clamp(3rem, 9vw, 5rem);
	line-height: 1;
	text-align: center;
	margin-top: auto;
	margin-bottom: auto;
}

.at_card_interpretation {
	margin-top: auto;
	font-size: 0.72rem;
	line-height: 1.25;
	text-align: center;
	color: #1f2933;
	width: 100%;
	padding-top: 6px;
	border-top: 1px solid rgba(15, 76, 117, 0.15);
}

.at_card_reversed_label {
	color: #ff8c00;
	font-weight: 700;
	margin-right: 4px;
}

.at_card--reversed .at_card_front {
	filter: saturate(0.82);
	display: grid;
	grid-template-rows: auto 1fr;
	align-items: stretch;
	justify-items: center;
}

.at_card--reversed .at_card_emoji {
	order: 2;
	transform: rotate(180deg);
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.at_card--reversed .at_card_interpretation {
	order: 1;
	margin-top: 0;
	margin-bottom: 10px;
	padding-top: 0;
	padding-bottom: 6px;
	border-top: none;
	border-bottom: 1px solid rgba(15, 76, 117, 0.15);
	align-self: start;
}

.at_card:focus-visible .at_card_inner {
	box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.45);
}

/* Responsive breakpoints for different screen sizes */
@media (max-width: 767px) {
	/* Mobile: 2 cards per row */
	.at_card {
		width: clamp(125px, 44vw, 190px);
	}

	/* Improve form layout on mobile */
	.form-inline {
		flex-direction: column;
		align-items: center;
		gap: 10px;
	}

	.form-inline .btn {
		margin: 5px;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	/* Tablet: 2-3 cards per row */
	.at_card {
		width: clamp(150px, 29vw, 200px);
	}
}

@media (min-width: 1024px) and (max-width: 1439px) {
	/* Desktop: 3-4 cards per row */
	.at_card {
		width: clamp(170px, 21vw, 220px);
	}
}

@media (min-width: 1440px) {
	/* Large desktop: 4 cards per row */
	.at_card {
		width: 220px;
	}
}

/* Additional responsive improvements */
@media (max-width: 575px) {
	/* Extra small devices */
	.jumbotron {
		padding: 1rem;
	}

	.display-4 {
		font-size: 2rem;
	}

	section.board,
	#mainGameBoard.board,
	#mainGameBoard {
		min-height: 40vh !important; /* Slightly smaller on very small screens */
		height: 40vh !important;
		padding: 8px;
		gap: 8px;
	}

	.at_card {
		width: clamp(112px, 45vw, 170px);
	}

	.at_card_interpretation {
		font-size: 0.66rem;
	}
}