/* =========================
   Babdori App Update
   ========================= */

html.has-babdori-app-update,
html.has-babdori-app-update body {
	overflow: hidden !important;
	overscroll-behavior: none;
}

/* 전체 배경 */
.babdori-app-update-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;

	display: flex;
	align-items: center;
	justify-content: center;

	width: 100%;
	height: 100%;
	padding:
		max(22px, env(safe-area-inset-top))
		18px
		max(22px, env(safe-area-inset-bottom));

	background: rgba(15, 23, 42, 0.54);

	animation:
		babdori-update-overlay-in
		0.18s ease both;
}

/* 팝업 카드 */
.babdori-app-update-modal {
	width: min(100%, 352px);
	margin: 0;
	padding: 25px 20px 19px;

	border: 1px solid rgba(226, 232, 240, 0.92);
	border-radius: 22px;

	background: #ffffff;
	color: #111827;

	text-align: center;

	box-shadow:
		0 22px 60px rgba(15, 23, 42, 0.2);

	animation:
		babdori-update-modal-in
		0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* 업데이트 아이콘 */
.babdori-app-update-icon {
	display: flex;
	align-items: center;
	justify-content: center;

	width: 54px;
	height: 54px;
	margin: 0 auto 16px;

	border-radius: 18px;

	background: #eef4ff;
	color: #2563eb;

	font-size: 28px;
	font-weight: 900;
	line-height: 1;
}

/* 제목 */
.babdori-app-update-title {
	margin: 0;

	color: #111827;

	font-family:
		'Pretendard',
		-apple-system,
		BlinkMacSystemFont,
		system-ui,
		'Segoe UI',
		sans-serif;

	font-size: 20px;
	font-weight: 800;
	line-height: 1.35;
	letter-spacing: -0.035em;
	word-break: keep-all;
}

/* 설명 */
.babdori-app-update-message {
	margin: 9px auto 0;

	color: #64748b;

	font-size: 14px;
	font-weight: 500;
	line-height: 1.6;
	letter-spacing: -0.02em;
	word-break: keep-all;
}

/* 현재/최신 버전 */
.babdori-app-update-version {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	min-height: 27px;
	margin: 13px 0 0;
	padding: 0 10px;

	border-radius: 999px;

	background: #f1f5f9;
	color: #64748b;

	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.01em;
}

/* 버튼 영역 */
.babdori-app-update-actions {
	display: flex;
	align-items: center;
	gap: 9px;

	width: 100%;
	margin-top: 21px;
}

/* 버튼 공통 */
.babdori-app-update-button {
	display: inline-flex;
	flex: 1;
	align-items: center;
	justify-content: center;

	min-width: 0;
	min-height: 48px;
	padding: 0 16px;

	border: 0;
	border-radius: 14px;

	font-family:
		'Pretendard',
		-apple-system,
		BlinkMacSystemFont,
		system-ui,
		'Segoe UI',
		sans-serif;

	font-size: 15px;
	font-weight: 800;
	line-height: 1;

	cursor: pointer;

	appearance: none;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;

	transition:
		transform 0.14s ease,
		background 0.14s ease,
		opacity 0.14s ease;
}

/* 닫기 */
.babdori-app-update-button.is-close {
	background: #f1f5f9;
	color: #475569;
}

/* 업데이트 */
.babdori-app-update-button.is-update {
	background: #2563eb;
	color: #ffffff;

	box-shadow:
		0 8px 18px rgba(37, 99, 235, 0.22);
}

.babdori-app-update-button:active {
	transform: scale(0.975);
}

.babdori-app-update-button:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.24);
	outline-offset: 2px;
}

/* 강제 업데이트일 때 버튼 하나 */
.babdori-app-update-actions
	.babdori-app-update-button:only-child {
	flex-basis: 100%;
}

/* 등장 효과 */
@keyframes babdori-update-overlay-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes babdori-update-modal-in {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* 작은 화면 */
@media (max-width: 360px) {
	.babdori-app-update-overlay {
		padding-left: 14px;
		padding-right: 14px;
	}

	.babdori-app-update-modal {
		padding:
			23px
			17px
			17px;
	}

	.babdori-app-update-title {
		font-size: 19px;
	}

	.babdori-app-update-message {
		font-size: 13px;
	}
}

/* 동작 최소화 설정 */
@media (prefers-reduced-motion: reduce) {
	.babdori-app-update-overlay,
	.babdori-app-update-modal {
		animation: none;
	}

	.babdori-app-update-button {
		transition: none;
	}
}

/* =========================
   Dark Mode
   ========================= */

@media (prefers-color-scheme: dark) {
	.babdori-app-update-overlay {
		background: rgba(0, 0, 0, 0.68);
	}

	.babdori-app-update-modal {
		border-color: rgba(255, 255, 255, 0.1);

		background: #151518;
		color: #f4f4f5;

		box-shadow:
			0 24px 64px rgba(0, 0, 0, 0.5);

		color-scheme: dark;
	}

	.babdori-app-update-icon {
		background: rgba(37, 99, 235, 0.16);
		color: #93c5fd;
	}

	.babdori-app-update-title {
		color: #f4f4f5;
	}

	.babdori-app-update-message {
		color: #a1a1aa;
	}

	.babdori-app-update-version {
		background: #232329;
		color: #a1a1aa;
	}

	.babdori-app-update-button.is-close {
		border: 1px solid rgba(255, 255, 255, 0.08);

		background: #232329;
		color: #d4d4d8;
	}

	.babdori-app-update-button.is-update {
		background: #3b82f6;
		color: #ffffff;

		box-shadow:
			0 8px 20px rgba(37, 99, 235, 0.26);
	}

	.babdori-app-update-button:focus-visible {
		outline-color: rgba(147, 197, 253, 0.32);
	}
}

.account-version-info {
	display: none;
}

body.is-app .account-version-info {
	display: flex;
}