/* Memory game module styles */

.memory-wrapper {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin-bottom: 30px;
}

.memory-main-panel {
	display: flex;
	gap: 15px;
	background: #181c24;
	padding: 20px;
	border-radius: 10px;
	box-shadow: 0 10px 25px rgba(0,0,0,0.3);
	border: 1px solid #2a313e;
}

.memory-board-container {
	position: relative;
	width: 480px;
	min-height: 480px;
}

#memory-board {
	position: relative;
	width: 480px;
	min-height: 480px;
	background: #0d1117;
	border-radius: 8px;
	box-shadow: inset 0 0 15px rgba(0,0,0,0.8);
	border: 2px solid #30363d;
	padding: 15px;
	box-sizing: border-box;
	display: grid;
	gap: 10px;
	align-content: center;
	justify-content: center;
}

#memory-board.grid-4x4 {
	grid-template-columns: repeat(4, 100px);
	grid-template-rows: repeat(4, 100px);
}

#memory-board.grid-6x4 {
	grid-template-columns: repeat(6, 68px);
	grid-template-rows: repeat(4, 68px);
}

#memory-board.grid-6x6 {
	grid-template-columns: repeat(6, 68px);
	grid-template-rows: repeat(6, 68px);
}

/* Card item 3D flip */
.memory-card {
	perspective: 1000px;
	cursor: pointer;
	user-select: none;
	width: 100%;
	height: 100%;
}

.card-inner {
	position: relative;
	width: 100%;
	height: 100%;
	transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	transform-style: preserve-3d;
	border-radius: 8px;
}

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

.card-front, .card-back {
	position: absolute;
	width: 100%;
	height: 100%;
	backface-visibility: hidden;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

.card-front {
	background: linear-gradient(135deg, #1f242d, #28303d);
	border: 2px solid #3b4454;
	box-shadow: 0 4px 8px rgba(0,0,0,0.4);
	color: #58a6ff;
	font-size: 24px;
	font-weight: bold;
}

.card-front:hover {
	border-color: #58a6ff;
	box-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
}

.card-back {
	background: #161b22;
	border: 2px solid #58a6ff;
	transform: rotateY(180deg);
	overflow: hidden;
	flex-direction: column;
	padding: 4px;
}

.card-back img {
	width: 80%;
	height: 80%;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid #30363d;
}

.card-back .card-nick {
	font-size: 9px;
	color: #c9d1d9;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

.memory-card.matched .card-back {
	border-color: #2ea44f;
	box-shadow: 0 0 10px rgba(46, 164, 79, 0.5);
}

.memory-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(13, 17, 23, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 20;
	border-radius: 6px;
	backdrop-filter: blur(4px);
}

.overlay-card {
	text-align: center;
	padding: 25px 20px;
	color: #fff;
	max-width: 320px;
}

.overlay-card h2 {
	color: #58a6ff;
	margin: 0 0 10px 0;
	font-size: 24px;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	text-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
}

.overlay-card p {
	font-size: 13px;
	color: #8b949e;
	margin-bottom: 20px;
	line-height: 1.4;
}

.btn-memory-action {
	padding: 10px 24px;
	font-size: 15px;
	font-weight: bold;
	border-radius: 6px;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.memory-sidebar-panel {
	display: flex;
	flex-direction: column;
	width: 150px;
	gap: 12px;
}

.memory-box {
	background: #21262d;
	border: 1px solid #30363d;
	border-radius: 6px;
	padding: 12px;
	text-align: center;
}

.memory-box h3 {
	margin: 0 0 10px 0;
	font-size: 13px;
	color: #8b949e;
	text-transform: uppercase;
	letter-spacing: 1px;
	border-bottom: 1px solid #30363d;
	padding-bottom: 4px;
}

.grid-dropdown {
	width: 100%;
	padding: 5px;
	background: #0d1117;
	border: 1px solid #30363d;
	color: #e9ecef;
	border-radius: 4px;
	font-size: 12px;
}

.memory-stats-box {
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-align: left;
}

.stat-item {
	display: flex;
	flex-direction: column;
}

.stat-label {
	font-size: 11px;
	color: #8b949e;
	text-transform: uppercase;
}

.stat-value {
	font-size: 18px;
	font-weight: bold;
	color: #58a6ff;
	font-family: monospace, monospace;
}

.memory-controls-btns {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: auto;
}

.memory-controls-btns .btn {
	width: 100%;
	font-size: 11px;
	padding: 6px 0;
}

.memory-mini-top-panel {
	flex: 1;
	min-width: 240px;
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.memory-mini-table {
	margin-bottom: 8px;
}

.mini-top-footer {
	text-align: right;
}

.memory-guide-box {
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 6px;
	padding: 12px 15px;
}

.memory-guide-box h4 {
	margin: 0 0 10px 0;
	font-size: 14px;
	color: #333;
}

.memory-guide-box ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.memory-guide-box li {
	font-size: 12px;
	color: #555;
	margin-bottom: 6px;
	line-height: 1.4;
}

.memory-guest-alert {
	margin-top: 15px;
	margin-bottom: 20px;
}

.memory-top-table th {
	background: #272d36;
	color: #58a6ff;
}

.memory-top-table td img {
	vertical-align: middle;
	margin-right: 4px;
}

@media (prefers-color-scheme: dark) {
	.memory-top-table th {
		background: #272d36 !important;
		color: #58a6ff !important;
		border-bottom: 2px solid #343b44 !important;
	}
	.memory-top-table td {
		border-top: 1px solid #2c343e !important;
		color: #c9d1d9;
	}
	.memory-top-table.table-striped tbody tr:nth-child(odd) td {
		background-color: #1e242c !important;
	}
	.memory-top-table.table-striped tbody tr:nth-child(even) td {
		background-color: #222831 !important;
	}
	.memory-top-table.table-hover tbody tr:hover td {
		background-color: #2c343e !important;
	}
	.memory-mini-table th {
		background: #21262d !important;
		color: #8b949e !important;
		border-bottom: 1px solid #30363d !important;
	}
	.memory-mini-table td {
		border-top: 1px solid #21262d !important;
		color: #c9d1d9;
	}
	.memory-guide-box {
		background: #1e242c !important;
		border-color: #343b44 !important;
	}
	.memory-guide-box h4 {
		color: #58a6ff !important;
	}
	.memory-guide-box li {
		color: #c9d1d9 !important;
	}
}

@media (max-width: 768px) {
	.memory-wrapper {
		flex-direction: column;
	}
	.memory-main-panel {
		flex-direction: column;
		align-items: center;
	}
	.memory-board-container, #memory-board {
		width: 340px;
		min-height: 340px;
	}
	#memory-board.grid-4x4 {
		grid-template-columns: repeat(4, 70px);
		grid-template-rows: repeat(4, 70px);
	}
	#memory-board.grid-6x4 {
		grid-template-columns: repeat(6, 45px);
		grid-template-rows: repeat(4, 45px);
	}
	#memory-board.grid-6x6 {
		grid-template-columns: repeat(6, 45px);
		grid-template-rows: repeat(6, 45px);
	}
	.memory-sidebar-panel {
		width: 340px;
		flex-direction: row;
		flex-wrap: wrap;
	}
	.memory-box {
		flex: 1;
		min-width: 130px;
	}
	.memory-controls-btns {
		width: 100%;
		flex-direction: row;
	}
}
