/* ==========================================================================
   動物カード 記憶ゲーム 専用スタイル
   ========================================================================== */

/* 3Dカードグリッド */
.card-grid {
	/* 絵文字サイズ調整（0.5〜0.95 目安。大きいほど絵文字が大きくなる） */
	--emoji-scale: 0.82;
	display: grid;
	gap: 10px;
	width: 100%;
	max-width: 400px;
	aspect-ratio: 1 / 1;
	margin: 20px auto;
	perspective: 1000px;
	/* 3D効果の奥行き */
}

/* カード要素本体 */
.card {
	position: relative;
	width: 100%;
	height: 100%;
	cursor: pointer;
	transform-style: preserve-3d;
	transition: transform 0.3s ease-in-out;
	container-type: size;
}

/* 裏向き（通常）から表向きへフリップ */
.card.flipped {
	transform: rotateY(180deg);
}

.card-face {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border-radius: 8px;
	backface-visibility: hidden;
	/* 裏面を隠す */
	display: flex;
	justify-content: center;
	align-items: center;
	box-sizing: border-box;
}

/* カード裏面 (デフォルト・回答待ち時) */
.card-back {
	background: #151a28;
	border: 2px solid #2d3748;
	box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
	transition: all 0.2s ease;
}

.card:hover .card-back {
	border-color: #4a5568;
	background: #1c2336;
}

/* カード表面 (動物表示・正解めくり時) */
.card-front {
	background: #ffffff;
	border: 2px solid #cbd5e0;
	transform: rotateY(180deg);
	/* 表面は最初から反転させておく */
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
	/* カード短辺に対する比率で絵文字サイズを決定 */
	font-size: calc(100cqmin * var(--emoji-scale));
	line-height: 1;
	overflow: hidden;
}

/* ハズレカードをめくってしまった際（ゲームオーバー表示） */
.card.wrong-card .card-front-wrong {
	background: linear-gradient(135deg, #ff4d4d, #cc0000);
	border: 2px solid #ff4d4d;
	box-shadow: 0 0 15px rgba(255, 77, 77, 0.6);
	transform: rotateY(180deg);
}

.card.wrong-card .card-front-wrong::after {
	content: "×";
	color: #fff;
	font-size: 1.8rem;
	font-weight: bold;
}

/* 「◯ はどこ？」問題表示 */
#game-instruction.is-question {
	font-size: 2rem;
	line-height: 1.3;
	margin-bottom: 12px;
}

#game-instruction .instruction-animal {
	display: inline-block;
	font-size: 3.2em;
	line-height: 1;
	vertical-align: middle;
	margin-right: 0.1em;
}
