/* =============================
Lightbox Base
============================= */
#lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.9);
	display: none;
	flex-direction: column;
	justify-content: space-between;
	z-index: 99999;

	touch-action: auto;
	overflow: hidden;
}

/* =============================
ステージ（画像操作領域）
============================= */
#lightbox .lb-stage {
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: visible; /* Safari の点滅防止 */
	width: 100%;
	height: 100%;
}

#lb-wrap {
	display: inline-block;
	transform-origin: center center;
	will-change: transform;
	/* touch-action は付けない！ */
}

#lb-img {
	max-width: min(90%, 100vw);
	max-height: min(90%, 100vh);
	width: auto;
	height: auto;

	user-select: none;
	touch-action: none; /* ← ここだけで OK */
}


/* =============================
上部バー（閉じる）
============================= */
.lb-topbar {
	height: 60px;
	display: flex;
	justify-content: flex-end;
	align-items: center;
	padding: 0 20px;
}

/* =============================
下部バー（前後ボタン）
============================= */
.lb-bottombar {
	height: 80px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 40px;
}

/* =============================
ボタン共通
============================= */
.lb-close,
.lb-prev,
.lb-next {
	font-size: 60px;
	color: #4a90e2;
	cursor: pointer;
	user-select: none;
	z-index: 10000;
	padding: 10px;
	background: rgba(0,0,0,0.3);
	border-radius: 6px;
}

/* PC では矢印を大きく */
@media (min-width: 900px) {
	.lb-prev,
	.lb-next {
		font-size: 100px;
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
	}
	.lb-prev{
		left: 20px;
	}
	.lb-next{
		right: 20px;
	}
	
}




/* =============================
Lightbox オープン時のスクロール禁止
============================= */
html.lb-open {
	overflow: hidden !important;
	touch-action: none !important;
	height: 100%;
}

body.lb-open {
	overflow: hidden !important;
	position: fixed;
	width: 100%;
	height: 100%;
	touch-action: none;
}

/* =============================
ピンチ中はボタンを完全に消す
============================= */
#lightbox.pinch-mode .lb-topbar,
#lightbox.pinch-mode .lb-bottombar {
	display: none !important;
}

/* =============================
スワイプ中の視覚的安定性
============================= */
#lightbox.swiping #lb-wrap {
	transition: none;
}
