/**
 * PWA standalone / fullscreen — native-app feel (blue theme).
 */

html.ach-splash-skip-boot #ach-pwa-splash {
	display: none !important;
}

html.ach-pwa-html,
html.ach-splash-active,
body.ach-pwa-standalone {
	margin: 0;
	min-height: 100%;
	min-height: 100dvh;
	overflow-x: hidden;
	-webkit-text-size-adjust: 100%;
}

html.ach-splash-active,
html.ach-splash-active body {
	overflow: hidden;
	height: 100%;
}

/* ── Intro splash slider ── */
.ach-pwa-splash {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: space-between;
	gap: 0;
	background:
		radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.14) 0%, transparent 55%),
		linear-gradient(165deg, var(--splash-from, var(--ach-pwa-accent, #003366)) 0%, var(--splash-to, #0d47a1) 100%);
	color: #f5f9ff;
	padding:
		calc(14px + env(safe-area-inset-top))
		18px
		calc(14px + env(safe-area-inset-bottom));
	transition: opacity 0.55s ease, visibility 0.55s ease, transform 0.55s ease;
	overflow: hidden;
	isolation: isolate;
}

.ach-pwa-splash.is-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: scale(1.03);
}

.ach-pwa-splash__fx {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 0;
}

.ach-pwa-splash__aurora {
	position: absolute;
	inset: -20%;
	background:
		radial-gradient(circle at 20% 30%, rgba(66, 165, 245, 0.35) 0%, transparent 42%),
		radial-gradient(circle at 80% 70%, rgba(144, 202, 249, 0.22) 0%, transparent 45%),
		radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
	animation: achSplashAurora 8s ease-in-out infinite alternate;
}

@keyframes achSplashAurora {
	0% { transform: translate3d(-2%, -1%, 0) scale(1); opacity: 0.85; }
	100% { transform: translate3d(2%, 1%, 0) scale(1.06); opacity: 1; }
}

.ach-pwa-splash__particles {
	position: absolute;
	inset: 0;
}

.ach-pwa-splash__particle {
	position: absolute;
	width: calc(4px + (var(--p-i) % 5) * 1.5px);
	height: calc(4px + (var(--p-i) % 5) * 1.5px);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	box-shadow: 0 0 12px rgba(144, 202, 249, 0.65);
	opacity: 0.45;
	animation: achSplashParticle 4s ease-in-out infinite;
	animation-delay: calc(var(--p-i) * -0.35s);
}

@keyframes achSplashParticle {
	0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.35; }
	50% { transform: translate3d(0, -18px, 0) scale(1.35); opacity: 0.95; }
}

.ach-pwa-splash__sparkles {
	position: absolute;
	inset: 0;
	background-image:
		radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.7) 0, transparent 100%),
		radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,0.5) 0, transparent 100%),
		radial-gradient(1.5px 1.5px at 70% 30%, rgba(255,255,255,0.6) 0, transparent 100%),
		radial-gradient(1px 1px at 90% 60%, rgba(255,255,255,0.45) 0, transparent 100%);
	animation: achSplashSparkle 3s linear infinite;
}

@keyframes achSplashSparkle {
	0%, 100% { opacity: 0.45; }
	50% { opacity: 0.9; }
}

.ach-pwa-splash__brand,
.ach-pwa-splash__slider,
.ach-pwa-splash__footer {
	position: relative;
	z-index: 1;
}

.ach-pwa-splash__brand {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 4px 2px 0;
	animation: achSplashFadeDown 0.7s ease both;
}

.ach-pwa-splash__logo {
	width: 52px;
	height: 52px;
	border-radius: 16px;
	object-fit: contain;
	background: transparent;
	box-shadow: none;
}

.ach-pwa-splash--no-particles .ach-pwa-splash__particles,
.ach-pwa-splash--no-particles .ach-pwa-splash__sparkles {
	display: none;
}

.ach-pwa-splash--no-aurora .ach-pwa-splash__aurora {
	display: none;
}

.ach-pwa-splash__slide {
	grid-area: 1 / 1;
	width: 100%;
	max-width: 420px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(18px) scale(0.96);
	transition:
		opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
		visibility 0.55s;
	pointer-events: none;
	position: relative;
}

.ach-pwa-splash__slide--gradient {
	background: linear-gradient(165deg, var(--splash-from, #003366) 0%, var(--splash-to, #0d47a1) 100%);
	border-radius: 20px;
}

.ach-pwa-splash__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	border-radius: 20px;
	pointer-events: none;
}

.ach-pwa-splash__bg--image {
	background-position: center;
	background-repeat: no-repeat;
}

.ach-pwa-splash__slide--fit-cover .ach-pwa-splash__bg--image {
	background-size: cover;
}

.ach-pwa-splash__slide--fit-stretch .ach-pwa-splash__bg--image {
	background-size: 100% 100%;
}

.ach-pwa-splash__slide--fit-contain .ach-pwa-splash__bg--image {
	background-size: contain;
}

.ach-pwa-splash__bg-video {
	display: block;
	width: 100%;
	height: 100%;
	object-position: center;
}

.ach-pwa-splash__slide--fit-cover .ach-pwa-splash__bg-video {
	object-fit: cover;
}

.ach-pwa-splash__slide--fit-stretch .ach-pwa-splash__bg-video {
	object-fit: fill;
}

.ach-pwa-splash__slide--fit-contain .ach-pwa-splash__bg-video {
	object-fit: contain;
}

.ach-pwa-splash__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: 20px;
	pointer-events: none;
	background: #000;
	opacity: var(--splash-overlay, 0.35);
}

.ach-pwa-splash__slide--gradient .ach-pwa-splash__overlay {
	opacity: 0;
}

.ach-pwa-splash__stage,
.ach-pwa-splash__copy {
	position: relative;
	z-index: 2;
}

.ach-pwa-splash__stage {
	position: relative;
	width: min(72vw, 300px);
	height: min(72vw, 300px);
	display: grid;
	place-items: center;
	background: transparent;
}

.ach-pwa-splash__ring {
	position: absolute;
	border-radius: 50%;
	border: 1px solid rgba(144, 202, 249, 0.28);
}

.ach-pwa-splash__ring--outer {
	inset: 0;
	background: radial-gradient(circle, rgba(26, 92, 255, 0.12) 0%, transparent 68%);
	animation: achSplashRingSpin 12s linear infinite;
}

.ach-pwa-splash__ring--inner {
	inset: 12%;
	background: radial-gradient(circle, rgba(0, 51, 102, 0.2) 0%, transparent 70%);
	animation: achSplashRingSpin 8s linear infinite reverse;
}

@keyframes achSplashRingSpin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

.ach-pwa-splash__mascot {
	position: relative;
	z-index: 2;
	width: 88%;
	height: 88%;
	object-fit: contain;
	background: transparent;
	mix-blend-mode: multiply;
	filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.28));
	animation: achSplashMascotFloat 3.2s ease-in-out infinite;
}

.ach-pwa-splash--blend-screen .ach-pwa-splash__mascot { mix-blend-mode: screen; }
.ach-pwa-splash--blend-darken .ach-pwa-splash__mascot { mix-blend-mode: darken; }
.ach-pwa-splash--blend-lighten .ach-pwa-splash__mascot { mix-blend-mode: lighten; }
.ach-pwa-splash--blend-normal .ach-pwa-splash__mascot { mix-blend-mode: normal; }
.ach-pwa-splash--blend-multiply .ach-pwa-splash__mascot { mix-blend-mode: multiply; }

@keyframes achSplashMascotFloat {
	0%, 100% { transform: translateY(0) scale(1); }
	50% { transform: translateY(-10px) scale(1.03); }
}

.ach-pwa-splash__brand-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.ach-pwa-splash__name {
	font-size: 1.05rem;
	font-weight: 800;
	color: #fff;
	letter-spacing: 0.01em;
	text-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
}

.ach-pwa-splash__tagline {
	font-size: 0.78rem;
	opacity: 0.88;
}

.ach-pwa-splash__slider {
	flex: 1;
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 8px 0 4px;
}

.ach-pwa-splash__slide.is-active {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.ach-pwa-splash__copy {
	text-align: center;
	padding: 0 8px;
}

.ach-pwa-splash__title {
	margin: 0;
	font-size: clamp(1.15rem, 4.5vw, 1.45rem);
	font-weight: 800;
	line-height: 1.45;
	text-shadow: 0 3px 18px rgba(0, 0, 0, 0.28);
}

.ach-pwa-splash__subtitle {
	margin: 8px 0 0;
	font-size: clamp(0.88rem, 3.4vw, 1rem);
	line-height: 1.65;
	opacity: 0.92;
}

.ach-pwa-splash__footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding-top: 6px;
	animation: achSplashFadeUp 0.7s ease 0.15s both;
}

.ach-pwa-splash__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.ach-pwa-splash__dot {
	width: 8px;
	height: 8px;
	border: none;
	border-radius: 999px;
	padding: 0;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.35);
	transition: width 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.ach-pwa-splash__dot.is-active {
	width: 26px;
	background: linear-gradient(90deg, #90caf9, #fff);
	transform: scale(1.05);
}

.ach-pwa-splash__progress {
	width: min(280px, 72vw);
	height: 4px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
	overflow: hidden;
}

.ach-pwa-splash__progress-fill {
	display: block;
	height: 100%;
	width: 0;
	border-radius: inherit;
	background: linear-gradient(90deg, #64b5f6, #fff 55%, #90caf9);
	box-shadow: 0 0 12px rgba(144, 202, 249, 0.75);
	transition: width 0.12s linear;
}

.ach-pwa-splash__skip {
	border: 1px solid rgba(255, 255, 255, 0.28);
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	border-radius: 999px;
	padding: 8px 20px;
	font-size: 0.82rem;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: background 0.2s ease, transform 0.2s ease;
}

.ach-pwa-splash__skip:hover {
	background: rgba(255, 255, 255, 0.18);
	transform: translateY(-1px);
}

@keyframes achSplashFadeDown {
	from { opacity: 0; transform: translateY(-12px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes achSplashFadeUp {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.ach-pwa-splash__aurora,
	.ach-pwa-splash__particle,
	.ach-pwa-splash__sparkles,
	.ach-pwa-splash__ring--outer,
	.ach-pwa-splash__ring--inner,
	.ach-pwa-splash__mascot {
		animation: none !important;
	}

	.ach-pwa-splash__slide {
		transition-duration: 0.01ms;
	}
}

/* ── Mobile install bar (browser mode) ── */
.ach-pwa-mobile-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99990;
	padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
	background: linear-gradient(180deg, rgba(13, 71, 161, 0.97) 0%, rgba(13, 71, 161, 1) 100%);
	border-top: 1px solid rgba(144, 202, 249, 0.45);
	box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.28);
	color: #eef6ff;
}

.ach-pwa-mobile-bar[hidden] {
	display: none !important;
}

.ach-pwa-mobile-bar__inner {
	display: flex;
	align-items: center;
	gap: 10px;
}

.ach-pwa-mobile-bar__text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ach-pwa-mobile-bar__text strong {
	font-size: 0.92rem;
}

.ach-pwa-mobile-bar__text span {
	font-size: 0.78rem;
	opacity: 0.9;
}

.ach-pwa-mobile-bar__btn {
	flex-shrink: 0;
	border: none;
	border-radius: 999px;
	padding: 10px 18px;
	font-size: 0.88rem;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	background: linear-gradient(135deg, #42a5f5, #1e88e5);
	color: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.ach-pwa-mobile-bar__close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}

.ach-pwa-mobile-bar__hint {
	margin: 8px 0 0;
	font-size: 0.76rem;
	line-height: 1.55;
	opacity: 0.92;
}

.ach-pwa-mobile-bar__hint code {
	font-size: 0.72rem;
	background: rgba(0, 0, 0, 0.2);
	padding: 1px 4px;
	border-radius: 4px;
}

body.ach-pwa-has-mobile-bar {
	padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ── Installed PWA: true fullscreen app shell ── */
@media (display-mode: standalone), (display-mode: fullscreen) {
	body.ach-pwa-standalone {
		background: var(--ach-pwa-bg, #eef6ff);
		padding-bottom: env(safe-area-inset-bottom);
	}

	body.ach-pwa-standalone .ach-pwa-mobile-bar {
		display: none !important;
	}

	body.ach-pwa-standalone .ach-header {
		position: sticky;
		top: 0;
		z-index: 1000;
		padding-top: env(safe-area-inset-top);
		background: linear-gradient(180deg, #0d47a1 0%, #1565c0 100%);
		border-bottom-color: rgba(144, 202, 249, 0.35);
	}

	body.ach-pwa-standalone .ach-footer {
		padding-bottom: max(16px, env(safe-area-inset-bottom));
	}

	body.ach-pwa-standalone .ach-main {
		min-height: calc(100dvh - 64px - env(safe-area-inset-top));
	}

	body.ach-pwa-standalone .ach-site {
		min-height: 100dvh;
		-webkit-tap-highlight-color: transparent;
		overscroll-behavior-y: contain;
	}

	body.ach-pwa-standalone .ach-pwa-install,
	body.ach-pwa-standalone .ach-android-apps {
		display: none !important;
	}
}

body.rc-body-app .rc-app {
	padding-top: env(safe-area-inset-top);
	padding-bottom: env(safe-area-inset-bottom);
	min-height: 100vh;
	min-height: 100dvh;
}
