/* Memory Match Card Game Styles */

.memory-match-main-columns {
	margin-top: 0.5rem;
}

.memory-match-main-card {
	border-radius: 12px;
	overflow: hidden;
}

/* Header icon styling */
.memory-header-icon {
	position: absolute;
	top: 5px;
	cursor: pointer;
}
.memory-header-icon-left {
	left: 8px;
}
.memory-header-icon-right {
	right: 8px;
}
.memory-header-icon.is-disabled {
	opacity: 0.35 !important;
	cursor: not-allowed !important;
	pointer-events: none !important;
}

/* Score display banner */
.memory-score-banner {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.4rem 1.25rem;
	border-radius: 24px;
	background: rgba(50, 152, 220, 0.12);
	border: 1px solid rgba(50, 152, 220, 0.35);
	margin: 0.25rem auto 1rem auto;
}
.memory-score-label {
	font-size: 0.95rem;
	font-weight: 500;
	color: #94a3b8;
}
body.light-mode .memory-score-label {
	color: #64748b;
}
.memory-score-value {
	font-size: 1.15rem;
	font-weight: 700;
	color: #38bdf8;
}
body.light-mode .memory-score-value {
	color: #0284c7;
}

/* Grid layout for cards */
.memory-board {
	width: 100%;
	margin: 0 auto;
	padding: 0.5rem 0.25rem;
}

.memory-grid-6 {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1rem;
	max-width: 580px;
	margin: 0 auto;
}

.memory-grid-8 {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.75rem;
	max-width: 720px;
	margin: 0 auto;
}

.memory-grid-10 {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 0.65rem;
	max-width: 820px;
	margin: 0 auto;
}

/* Playing Card Component */
.memory-card {
	position: relative;
	aspect-ratio: 5 / 7;
	perspective: 1000px;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	transition: transform 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}

.memory-card:hover:not(.is-matched):not(.is-flipped) {
	transform: translateY(-4px) scale(1.02);
}

.memory-card:active:not(.is-matched):not(.is-flipped) {
	transform: scale(0.97);
}

.memory-card.is-matched {
	cursor: default;
}

/* Inner 3D container */
.memory-card-inner {
	position: relative;
	width: 100%;
	height: 100%;
	text-align: center;
	transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
	transform-style: preserve-3d;
	border-radius: 10px;
}

.memory-card.is-flipped .memory-card-inner,
.memory-card.is-matched .memory-card-inner {
	transform: rotateY(180deg);
}

/* Faces */
.memory-card-front,
.memory-card-back {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	border-radius: 10px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
	overflow: hidden;
}

/* Face Down (Card Back image shown) */
.memory-card-front {
	transform: rotateY(0deg);
	background: #ffffff;
	border: 1px solid #94a3b8;
	display: flex;
	align-items: center;
	justify-content: center;
}

.memory-card-front img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

/* Face Up (Revealed Content) */
.memory-card-back {
	transform: rotateY(180deg);
	background: #ffffff;
	color: #0f172a;
	border: 2px solid #cbd5e1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
	box-sizing: border-box;
}

/* Matched Card Styling */
.memory-card.is-matched .memory-card-back {
	border-color: #48c774 !important;
	background: #f0fdf4 !important;
	box-shadow: 0 0 14px rgba(72, 199, 116, 0.45), 0 4px 10px rgba(0, 0, 0, 0.12);
}

.memory-card.is-matched::after {
	content: "\2713";
	position: absolute;
	top: 4px;
	right: 6px;
	font-size: 0.9rem;
	font-weight: 700;
	color: #16a34a;
	z-index: 10;
	pointer-events: none;
}

/* Image Card Face */
.memory-card-img-wrap {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	box-sizing: border-box;
}

.memory-card-img {
	max-width: 94%;
	max-height: 94%;
	object-fit: contain;
	border-radius: 6px;
	pointer-events: none;
}

/* Word Card Face */
.memory-card-word-wrap {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 4px 6px;
	box-sizing: border-box;
}

.memory-card-thai {
	font-family: "Sarabun", "Noto Sans Thai", "Segoe UI", sans-serif;
	font-size: 1.45rem;
	font-weight: 700;
	color: #0f172a !important;
	line-height: 1.25;
	margin-bottom: 2px;
	word-break: break-word;
}

.memory-card-trans {
	font-style: italic;
	font-size: 0.88rem;
	color: #475569 !important;
	line-height: 1.2;
	margin-bottom: 6px;
	word-break: break-word;
}

.memory-card-audio {
	margin-top: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.memory-audio-icon-span {
	cursor: pointer;
	color: #3298dc;
	transition: transform 0.15s ease, color 0.15s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 3px;
	border-radius: 50%;
}

.memory-audio-icon-span:hover {
	color: #1d72aa;
	transform: scale(1.15);
}

/* Pulsing audio icon animation (matching site audio) */
.memory-audio-icon-span.is-pulsing {
	animation: blinker 1s linear infinite;
	cursor: default;
}

/* Results section thumbnail */
.memory-match-thumb {
	max-height: 48px;
	max-width: 56px;
	width: auto;
	object-fit: contain;
	border-radius: 4px;
	vertical-align: middle;
	background-color: rgba(255, 255, 255, 0.05);
	padding: 2px;
}
body.light-mode .memory-match-thumb {
	background-color: #f1f5f9;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
	.memory-grid-6 {
		gap: 0.65rem;
		max-width: 440px;
	}
	.memory-grid-8 {
		grid-template-columns: repeat(4, 1fr);
		gap: 0.5rem;
		max-width: 520px;
	}
	.memory-grid-10 {
		grid-template-columns: repeat(5, 1fr);
		gap: 0.4rem;
		max-width: 600px;
	}
	.memory-card-thai {
		font-size: 1.25rem;
	}
	.memory-card-trans {
		font-size: 0.78rem;
	}
}

@media screen and (max-width: 480px) {
	.memory-grid-6 {
		gap: 0.5rem;
		max-width: 100%;
	}
	.memory-grid-8 {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.6rem;
		max-width: 260px;
	}
	.memory-grid-10 {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.6rem;
		max-width: 260px;
	}
	.memory-card-thai {
		font-size: 1.15rem;
	}
	.memory-card-trans {
		font-size: 0.72rem;
		margin-bottom: 3px;
	}
}

/* Settings modal options alignment */
.memory-settings-container {
	max-width: 320px;
	margin: 0 auto;
	text-align: left;
}

.memory-settings-options {
	text-align: left;
}

.memory-settings-radio,
#memoryMatchSettings_modal_div .radio {
	margin-left: 0 !important;
	display: inline-flex !important;
	align-items: center;
	gap: 0.5rem;
	text-align: left !important;
	cursor: pointer;
}

.memory-settings-checkbox,
#memoryMatchSettings_modal_div .checkbox {
	margin-left: 0 !important;
	display: inline-flex !important;
	align-items: center;
	gap: 0.5rem;
	text-align: left !important;
	cursor: pointer;
}

.memory-settings-radio input[type="radio"],
.memory-settings-checkbox input[type="checkbox"] {
	margin: 0 !important;
	vertical-align: middle;
	flex-shrink: 0;
}

/* Completion text spacing */
.memory-match-complete-title {
	margin-bottom: 0.75rem !important;
}

.memory-match-complete-subtitle {
	margin-top: 0.75rem !important;
	margin-bottom: 0.75rem !important;
}

