/**
 * おまかせセキュリティ フロントスタイル
 *
 * z-index 設計:
 *   透かし        99990（最前面だがクリック透過）
 *   下部注意バー   99991
 *   ぼかしオーバーレイ 2147483645
 *   ポップアップ   2147483646（AIチャット等の外部ウィジェットより前面）
 *   トースト       2147483647（最上位）
 */

/* ---- テキスト選択抑止 ---- */
body.oms-noselect {
	-webkit-user-select: none;
	user-select: none;
}
body.oms-noselect input,
body.oms-noselect textarea,
body.oms-noselect select,
body.oms-noselect [contenteditable="true"] {
	-webkit-user-select: text;
	user-select: text;
}

/* ---- 画面全体の透かし ---- */
.oms-watermark {
	position: fixed;
	inset: 0;
	z-index: 99990;
	pointer-events: none;
	background-repeat: repeat;
}

/* ---- 下部固定注意バー ---- */
.oms-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99991;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 8px 12px;
	padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
	font-size: 12px;
	line-height: 1.5;
	text-align: center;
	box-sizing: border-box;
}
.oms-bar__text {
	overflow-wrap: anywhere;
}

/* モバイルでは、IP・端末表示が入っても高さが膨らまないよう余白・行間・文字を詰める */
@media (max-width: 600px) {
	.oms-bar {
		font-size: 10px;
		line-height: 1.25;
		padding: 2px 8px;
		padding-bottom: calc(2px + env(safe-area-inset-bottom, 0px));
		gap: 4px;
	}
}

/*
 * 下部ツールバー（#mobile-app-nav 等）の上に持ち上げているときは、
 * セーフエリア（ホームインジケータ）ぶんの余白は下のツールバー側が負担するため、
 * バー自身の下余白は最小にする（PWA表示での下部の黒い余白を解消）。
 */
.oms-bar.oms-bar--lifted {
	padding-top: 2px;
	padding-bottom: 2px;
}
.oms-bar__close {
	flex: 0 0 auto;
	background: transparent;
	border: none;
	font-size: 18px;
	line-height: 1;
	padding: 2px 6px;
	cursor: pointer;
	opacity: 0.8;
}
.oms-bar__close:hover {
	opacity: 1;
}

/* ---- 注意喚起ポップアップ ---- */
.oms-popup {
	position: fixed;
	inset: 0;
	z-index: 2147483646;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(0, 0, 0, 0.65);
	box-sizing: border-box;
}
.oms-popup[hidden] {
	display: none;
}
.oms-popup__panel {
	max-width: 480px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	border-radius: 10px;
	padding: 28px 24px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
	box-sizing: border-box;
}
.oms-popup__title {
	margin: 0 0 16px;
	font-size: 18px;
	font-weight: 700;
	text-align: center;
}
.oms-popup__body {
	font-size: 14px;
	line-height: 1.9;
	margin-bottom: 20px;
}
.oms-popup__button {
	display: block;
	width: 100%;
	border: none;
	border-radius: 6px;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	padding: 12px;
	cursor: pointer;
}
.oms-popup__button:hover {
	opacity: 0.9;
}
body.oms-popup-open {
	overflow: hidden;
}

/* ---- ぼかしオーバーレイ（フォーカスアウト / スクリーンショット抑止） ---- */
.oms-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483645;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(20, 20, 30, 0.55);
	-webkit-backdrop-filter: blur(var(--oms-blur, 8px));
	backdrop-filter: blur(var(--oms-blur, 8px));
	cursor: pointer;
	box-sizing: border-box;
}
.oms-overlay[hidden] {
	display: none;
}
.oms-overlay__message {
	max-width: 420px;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	font-size: 14px;
	line-height: 1.9;
	text-align: center;
	border-radius: 10px;
	padding: 20px 24px;
}

/* ---- 警告トースト ---- */
.oms-toast {
	position: fixed;
	left: 50%;
	bottom: 72px;
	transform: translateX(-50%);
	z-index: 2147483647;
	max-width: calc(100vw - 40px);
	background: rgba(214, 54, 56, 0.95);
	color: #fff;
	font-size: 13px;
	line-height: 1.6;
	border-radius: 6px;
	padding: 10px 16px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
	text-align: center;
}
.oms-toast.is-visible {
	opacity: 1;
}

/* ---- 印刷抑止 ---- */
.oms-print-message {
	display: none;
}
@media print {
	/* visibility ベースの制御にすることで、テーマのDOM構造に依存せず本文を非表示にできる */
	body.oms-print-block * {
		visibility: hidden !important;
	}
	body.oms-print-block .oms-print-message,
	body.oms-print-block .oms-print-message * {
		visibility: visible !important;
	}
	body.oms-print-block .oms-print-message {
		display: block;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		padding: 80px 40px;
		text-align: center;
		font-size: 16px;
		line-height: 2;
	}
	/* 透かし・バー等の抑止UIも印刷には不要 */
	body.oms-print-block .oms-watermark,
	body.oms-print-block .oms-bar,
	body.oms-print-block .oms-overlay,
	body.oms-print-block .oms-toast,
	body.oms-print-block .oms-popup {
		display: none !important;
	}
}
