.container {
	display: flex;
	height: 550px;
	width: 100%;
}

.main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding: 2px;
	min-width: 0;
}

.stats-bar {
	background: #fffbec;
	padding: 3px;
	border: 2px solid #efebd6;
	border-radius: 8px;
	margin-bottom: 3px;
	display: flex;
	justify-content: space-around;
	gap: 5px;
}

.stat-item {
	text-align: center;
	flex: 1;
}

.stat-label {
	font-size: 0.9em;
	color: #5f5151;
	margin-bottom: 2px;
	line-height: 1.2;
}

.stat-value {
	font-size: 1em;
	font-weight: bold;
	color: #5f5151;
}

.game-board {
	background: #fffbec;
	border: 2px solid #efebd6;
	border-radius: 12px;
	padding: 10px;
	backdrop-filter: blur(10px);
	/* box-shadow: 0 8px 32px rgba(0,0,0,0.3); */
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	overflow: hidden;
	min-height: 0;
}

.cards-container {
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	gap: 5px;
}

.card-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.card-label {
	font-size: clamp(0.75em, 2vw, 1em);
	margin-bottom: 5px;
	color: #5f5151;
}

.card-container {
	perspective: 1000px;
	width: clamp(100px, 31vw, 150px);
	height: clamp(140px, 45vw, 220px);
	flex-shrink: 0;
}

.card {
	width: 100%;
	height: 100%;
	position: relative;
	transform-style: preserve-3d;
	transition: transform 0.6s;
}

.card.flipped {
	transform: rotateY(180deg);
}

.card-face {
	width: 100%;
	height: 100%;
	position: absolute;
	backface-visibility: hidden;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0,0,0,0.4);

}

.card-front {
	background: white;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 10px;
	transform: rotateY(180deg);
}

.card-front::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image: var(--card-front-image);
	background-size: var(--card-front-size, 80%);
	background-position: var(--card-front-position-x, 50%) var(--card-front-position-y, 50%);
	background-repeat: no-repeat;
	opacity: var(--card-front-opacity, 0.3);
	pointer-events: none;
	border-radius: 8px;
	z-index: 0;
}

.card-back {
	background: linear-gradient(135deg, #283fa5 0%, #092266 100%);
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: clamp(1.8em, 4.5vw, 2.5em);
	color: white;
	/* position: relative; は追加しない */
}

.card-back::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image: var(--card-back-image);
	background-size: var(--card-back-size, 80%);
	background-position: var(--card-back-position-x, 50%) var(--card-back-position-y, 50%);
	background-repeat: no-repeat;
	opacity: var(--card-back-opacity, 1);
	pointer-events: none;
	border-radius: 8px;
	z-index: 1;
}

.card-number {
	font-size: clamp(1.2em, 3.5vw, 2em);
	font-weight: bold;
	color: #c41e3a;
}

.card-suit {
	font-size: clamp(0.9em, 2vw, 1.3em);
	color: #c41e3a;
}

.card-center {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: clamp(1.5em, 5vw, 3em);
	font-weight: bold;
	color: #c41e3a;
	opacity: 0.3;
}

.vs-text {
	font-size: clamp(1.2em, 3.5vw, 1.2em);
	font-weight: bold;
	color: #5f5151;
	text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
	margin: 0 10px;
}

.result {
	font-size: clamp(1.0em, 3vw, 1.2em);
	font-weight: bold;
	margin: 8px 0;
	text-align: center;
	min-height: 35px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1.3;
}

.win {
	color: #092266;
	text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
	animation: pulse 0.5s ease;
}

.lose {
	color: #ff6b6b;
	text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
	animation: shake 0.5s ease;
}

.perfect {
	color: #092266;
	text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
	animation: pulse 0.5s ease;
}

.claim {
	color: #092266;
	text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

@keyframes pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.1); }
}

@keyframes shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-10px); }
	75% { transform: translateX(10px); }
}

.buttons {
	display: flex;
	justify-content: center;
	gap: 15px;
	flex-wrap: wrap;
}

button {
	padding: clamp(8px, 1.5vw, 14px) clamp(15px, 3vw, 30px);
	font-size: clamp(0.85em, 2vw, 1.1em);
	font-weight: bold;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(0,0,0,0.3);
	white-space: nowrap;
}

.btn-high {
	background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
	color: white;
}

.btn-low {
	background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
	color: white;
}

.btn-start {
	background: linear-gradient(135deg, #16a0fc 0%, #0099ff 100%);
	color: white;
}

.btn-claim {
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
	color: white;
}

button:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.rewards-panel {
	width: clamp(140px, 22vw, 140px);
	background: #fffbec;
	backdrop-filter: blur(10px);
	/* box-shadow: 0 8px 32px rgba(0,0,0,0.3); */
	border: 2px solid #efebd6;
	border-radius: 12px;
	margin: 8px 0px 8px 0px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.rewards-title {
	font-size: clamp(1em, 1.8vw, 1.3em);
	font-weight: bold;
	padding: 12px 8px;
	color: #5f5151;
	text-align: center;
	background: rgba(0,0,0,0.2);
}

.current-reward-container {
	padding: 10px 8px;
	background: #fffbec;
	border-bottom: 2px solid #efebd6;;
}

.current-reward-label {
	font-size: 0.75em;
	color: #5f5151;
	text-align: center;
	margin-bottom: 6px;
}

.rewards-scroll-container {
	flex: 1;
	overflow-y: auto;
	padding: 8px;
	scroll-behavior: smooth;
}

.rewards-scroll-container::-webkit-scrollbar {
	width: 4px;
}

.rewards-scroll-container::-webkit-scrollbar-track {
	background: rgba(255,255,255,0.1);
}

.rewards-scroll-container::-webkit-scrollbar-thumb {
	background: #5f5151;
	border-radius: 4px;
}

.reward-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 6px;
	margin-bottom: 6px;
	border-radius: 8px;
	background: rgba(255,255,255,0.05);
	transition: all 0.5s ease;
	opacity: 0.4;
}

.reward-images {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 4px;
	margin-bottom: 4px;
}

.reward-images img {
	width: 50px;
	height: 50px;
	object-fit: contain;
	border-radius: 8px;
}

.reward-item.active {
	opacity: 1;
	background: rgba(255,215,0,0.2);
	box-shadow: 0 0 20px rgba(255,215,0,0.4);
	transform: scale(1.05);
}

.reward-item.lost {
	opacity: 1;
	background: rgba(0,0,0,0.6);
	box-shadow: 0 0 20px rgba(0,0,0,0.8);
	transform: scale(0.95);
	filter: grayscale(100%);
}

.reward-icon {
	font-size: 1.5em;
	margin-bottom: 3px;
}

.reward-text {
	font-size: 0.7em;
	text-align: center;
	color: #5f5151;
	line-height: 1.2;
}

.reward-level {
	font-size: 0.7em;
	color: #5f5151;
	margin-top: 2px;
	font-weight: bold;
}

.current-reward-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 8px;
	border-radius: 8px;
	background: rgba(255,215,0,0.2);
	box-shadow: 0 0 20px rgba(255,215,0,0.4);
}

.current-reward-item .reward-icon {
	font-size: 2em;
}

.current-reward-item .reward-text {
	font-size: 0.7em;
	font-weight: bold;
}

/* モバイル用ここから */
@media (max-width: 768px) {
	.container {
		flex-direction: column;
		height: 100vh;
	}

	.rewards-panel {
		width: 100%;
		max-height: 35vh;

	}

	.main-content {
		flex: 1;
		padding: 2px;
	}

	.stats-bar {
		padding: 6px;
		margin-bottom: 1px;
	}

	.game-board {
		padding: 8px;
	}

	.result {
		margin: 3px 0;
		min-height: 30px;
	}
}
/* モバイル用ここまで */

/* 紙吹雪のスタイル */
.confetti {
	position: fixed;
	width: 10px;
	height: 10px;
	z-index: 9999;
	pointer-events: none;
}

@keyframes confetti-fall {
	0% {
		transform: translateY(0) rotateZ(0deg);
		opacity: 1;
	}
	100% {
		transform: translateY(-100vh) rotateZ(720deg);
		opacity: 0;
	}
}

@keyframes confetti-drop {
	0% {
		transform: translateY(-100vh) rotateZ(0deg);
		opacity: 1;
	}
	100% {
		transform: translateY(100vh) rotateZ(720deg);
		opacity: 0;
	}
}

/* Safari用 backface-visibility 修正 */
@supports (-webkit-backdrop-filter: none) {
	.card, .card-face {
		-webkit-backface-visibility: hidden;
		-webkit-transform-style: preserve-3d;
	}
}