:root {
	--appi-bg: #ffffff;
	--appi-text: #0f172a;
	--appi-muted: #64748b;
}

/* Professional install prompt — clean modal, compact content, inherited site typography. */
.appi-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 20px 14px calc(20px + env(safe-area-inset-bottom));
	background: rgba(15, 23, 42, .20);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	direction: rtl;
	animation: appiBackdropIn .2s ease both;
}
.appi-overlay[hidden] { display: none !important; }
.appi-overlay.is-closing { animation: appiBackdropOut .16s ease both; }
@keyframes appiBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes appiBackdropOut { from { opacity: 1; } to { opacity: 0; } }

.appi-install-card,
.appi-install-card * {
	box-sizing: border-box;
	font-family: inherit !important;
}

.appi-install-card {
	position: relative;
	width: min(520px, 100%);
	padding: 18px;
	border: 1px solid rgba(226, 232, 240, .96);
	border-radius: 24px;
	background: #ffffff;
	box-shadow: 0 28px 80px rgba(15, 23, 42, .24), 0 8px 24px rgba(15, 23, 42, .10);
	animation: appiCardIn .28s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes appiCardIn {
	from { opacity: 0; transform: translateY(24px) scale(.97); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.appi-install-content {
	display: flex;
	align-items: center;
	gap: 14px;
	padding-left: 30px;
}

.appi-install-icon-wrap {
	width: 64px;
	height: 64px;
	flex: 0 0 64px;
}
.appi-app-icon {
	display: block;
	width: 64px;
	height: 64px;
	border: 1px solid rgba(15, 23, 42, .07);
	border-radius: 18px;
	object-fit: cover;
	background: #f1f5f9;
	box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
}
.appi-app-icon-placeholder {
	display: grid;
	place-items: center;
	background: linear-gradient(145deg, var(--appi-header-color, #2563eb), #1d4ed8);
	color: #fff;
	font-size: 11px;
	font-weight: 900;
	letter-spacing: .6px;
}

.appi-install-copy {
	min-width: 0;
	flex: 1;
	text-align: right;
}
.appi-install-copy h3 {
	margin: 0 0 6px;
	color: var(--appi-title-color, #0f172a);
	font-size: var(--appi-title-size, 16px);
	font-weight: var(--appi-title-weight, 800);
	line-height: 1.55;
}
.appi-install-copy p {
	display: -webkit-box;
	margin: 0;
	color: var(--appi-desc-color, #64748b);
	font-size: var(--appi-desc-size, 11px);
	font-weight: var(--appi-desc-weight, 500);
	line-height: 1.7;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}

.appi-install-actions {
	display: flex;
	justify-content: flex-start;
	margin-top: 15px;
}
.appi-install-button {
	--appi-ios-blue: #007aff;
	--appi-ios-blue-top: #0a84ff;
	--appi-ios-blue-pressed: #0067d9;
	position: relative;
	isolation: isolate;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 190px;
	height: max(var(--appi-button-height, 50px), 50px);
	padding: 0 22px;
	overflow: hidden;
	border: 1px solid rgba(0, 92, 214, .78);
	border-radius: 15px;
	background: linear-gradient(180deg, var(--appi-ios-blue-top) 0%, var(--appi-ios-blue) 72%, #0072ee 100%);
	color: #ffffff;
	font-size: max(var(--appi-button-size, 17px), 15px);
	font-weight: 600;
	line-height: 1;
	letter-spacing: -.2px;
	text-shadow: 0 1px 0 rgba(0, 60, 145, .18);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.38),
		inset 0 -1px 0 rgba(0,50,140,.22),
		0 7px 16px rgba(0,122,255,.26),
		0 1px 2px rgba(0,45,110,.18);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition:
		transform .14s cubic-bezier(.2,.8,.2,1),
		filter .14s ease,
		box-shadow .14s ease,
		background .14s ease;
}
.appi-install-button::before {
	content: "";
	position: absolute;
	inset: 1px 1px auto;
	height: 46%;
	z-index: -1;
	border-radius: 13px 13px 10px 10px;
	background: linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,0));
	pointer-events: none;
}
.appi-install-button::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -2;
	border-radius: inherit;
	box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
	pointer-events: none;
}
@media (hover: hover) {
	.appi-install-button:hover {
		filter: brightness(1.035) saturate(1.03);
		transform: translateY(-1px);
		box-shadow:
			inset 0 1px 0 rgba(255,255,255,.42),
			inset 0 -1px 0 rgba(0,50,140,.22),
			0 9px 20px rgba(0,122,255,.31),
			0 1px 2px rgba(0,45,110,.18);
	}
}
.appi-install-button:active,
.appi-install-button.is-pressed {
	transform: translateY(1px) scale(.972);
	filter: none;
	background: linear-gradient(180deg, #087cf2 0%, var(--appi-ios-blue-pressed) 100%);
	box-shadow:
		inset 0 2px 5px rgba(0,45,110,.28),
		inset 0 1px 0 rgba(255,255,255,.18),
		0 2px 5px rgba(0,122,255,.18);
}
.appi-install-button:focus-visible {
	outline: none;
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.38),
		0 0 0 3px rgba(255,255,255,.96),
		0 0 0 6px rgba(0,122,255,.38),
		0 7px 16px rgba(0,122,255,.24);
}
.appi-install-button[disabled] {
	opacity: .62;
	cursor: wait;
	transform: none;
	filter: grayscale(.08);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.28),
		0 4px 10px rgba(0,122,255,.16);
}
.appi-install-button[disabled] .appi-install-button-icon {
	animation: appiInstallSpin .8s linear infinite;
}
@keyframes appiInstallSpin { to { transform: rotate(360deg); } }
.appi-install-button-icon {
	display: grid;
	place-items: center;
	width: 19px;
	height: 19px;
	flex: 0 0 19px;
	filter: drop-shadow(0 1px 0 rgba(0,55,135,.20));
}
.appi-install-button-icon svg {
	width: 19px;
	height: 19px;
	fill: currentColor;
}
.appi-install-button-text {
	position: relative;
	top: -.2px;
}
.appi-install-icon-ios { display: none; }
.appi-overlay[data-platform="ios"] .appi-install-icon-default { display: none; }
.appi-overlay[data-platform="ios"] .appi-install-icon-ios { display: grid; }

/* iPhone-style circular close control, inspired by native iOS sheets. */
.appi-close {
	position: absolute;
	top: 12px;
	left: 12px;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(118,118,128,.12);
	color: rgba(60,60,67,.72);
	box-shadow:
		inset 0 0 0 .5px rgba(60,60,67,.12),
		inset 0 1px 0 rgba(255,255,255,.58),
		0 2px 6px rgba(15,23,42,.08);
	backdrop-filter: saturate(180%) blur(18px);
	-webkit-backdrop-filter: saturate(180%) blur(18px);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
	transition:
		transform .14s cubic-bezier(.2,.8,.2,1),
		background .14s ease,
		color .14s ease,
		box-shadow .14s ease;
}
@media (hover: hover) {
	.appi-close:hover {
		background: rgba(118,118,128,.18);
		color: rgba(28,28,30,.82);
		transform: scale(1.035);
		box-shadow:
			inset 0 0 0 .5px rgba(60,60,67,.16),
			inset 0 1px 0 rgba(255,255,255,.66),
			0 4px 10px rgba(15,23,42,.10);
	}
}
.appi-close:active {
	transform: scale(.88);
	background: rgba(118,118,128,.25);
	box-shadow:
		inset 0 1px 3px rgba(60,60,67,.16),
		0 1px 2px rgba(15,23,42,.05);
}
.appi-close:focus-visible {
	outline: none;
	box-shadow:
		inset 0 0 0 .5px rgba(60,60,67,.14),
		0 0 0 3px rgba(255,255,255,.96),
		0 0 0 6px rgba(0,122,255,.28);
}
.appi-close svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
	stroke: none;
}

@media (max-width: 560px) {
	.appi-overlay {
		padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
		background: rgba(15, 23, 42, .24);
	}
	.appi-install-card {
		width: 100%;
		padding: 16px;
		border-radius: 22px;
	}
	.appi-install-content {
		align-items: flex-start;
		gap: 12px;
		padding-left: 24px;
	}
	.appi-install-icon-wrap,
	.appi-app-icon {
		width: 58px;
		height: 58px;
	}
	.appi-install-icon-wrap { flex-basis: 58px; }
	.appi-app-icon { border-radius: 16px; }
	.appi-install-copy h3 { margin-top: 1px; }
	.appi-install-actions { margin-top: 14px; }
	.appi-install-button {
		width: 100%;
		min-width: 0;
	}
}

@media (max-width: 360px) {
	.appi-install-card { padding: 14px; border-radius: 20px; }
	.appi-install-content { gap: 10px; padding-left: 22px; }
	.appi-install-icon-wrap,
	.appi-app-icon { width: 52px; height: 52px; }
	.appi-install-icon-wrap { flex-basis: 52px; }
	.appi-app-icon { border-radius: 15px; }
}

@media (prefers-reduced-motion: reduce) {
	.appi-overlay,
	.appi-install-card,
	.appi-install-button { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Installed-app launch screen: only the configured 1080×1920 image and a real progress line. */
.appi-splash {
	position: fixed;
	inset: 0;
	z-index: 9999999;
	display: none;
	align-items: flex-end;
	justify-content: center;
	overflow: hidden;
	transition: opacity .34s ease;
}
html.appi-standalone-launch .appi-splash { display: flex; }
.appi-splash.is-hidden { display: none !important; }
.appi-splash.is-hiding { opacity: 0; }
.appi-splash-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	user-select: none;
	-webkit-user-drag: none;
}
.appi-splash-progress-wrap {
	position: relative;
	z-index: 2;
	width: min(72vw, 360px);
	margin-bottom: calc(28px + env(safe-area-inset-bottom));
}
.appi-splash-progress {
	position: relative;
	width: 100%;
	height: 3px;
	overflow: hidden;
	border-radius: 999px;
	background: rgba(255,255,255,.30);
	box-shadow: 0 1px 10px rgba(0,0,0,.20);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}
.appi-splash-progress > span {
	display: block;
	width: 0%;
	height: 100%;
	border-radius: inherit;
	background: #fff;
	box-shadow: 0 0 10px rgba(255,255,255,.8);
	transition: width .16s linear;
}

/* Earliest standalone paint: show only the selected launch image before body markup is available. */
html.appi-standalone-launch:not(.appi-splash-finished)::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 9999998;
	background-color: #0f172a;
	background-image: var(--appi-early-splash-image, none);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	pointer-events: none;
}
html.appi-standalone-launch:not(.appi-splash-finished)::after {
	content: "";
	position: fixed;
	left: 50%;
	bottom: calc(28px + env(safe-area-inset-bottom));
	z-index: 9999999;
	width: min(72vw, 360px);
	height: 3px;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 0 10px rgba(255,255,255,.8), 0 1px 10px rgba(0,0,0,.2);
	transform: translateX(-50%) scaleX(var(--appi-early-progress, .03));
	transform-origin: left center;
	transition: transform .16s linear;
	pointer-events: none;
}
