/* Quiet engagement — sticky download, prev/next, recent, chips */
.apk365-sticky-dl {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99980;
	padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
	background: linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.55) 35%, rgba(15, 23, 42, 0.85));
	pointer-events: none;
}

.apk365-sticky-dl[hidden] {
	display: none !important;
}

.apk365-sticky-dl__btn {
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	max-width: 520px;
	margin: 0 auto;
	min-height: 48px;
	padding: 12px 18px;
	border-radius: 12px;
	background: #1bbc9b;
	color: #fff !important;
	font-weight: 700;
	font-size: 1rem;
	text-decoration: none !important;
	box-shadow: 0 10px 28px rgba(27, 188, 155, 0.4);
}

.apk365-sticky-dl__btn:hover,
.apk365-sticky-dl__btn:focus {
	background: #17a589;
	color: #fff !important;
}

@media (min-width: 769px) {
	.apk365-sticky-dl {
		padding-bottom: 16px;
	}
}

/* Lift above bottom nav on mobile */
@media (max-width: 768px) {
	body:has(#px-bottom-menu) .apk365-sticky-dl {
		bottom: 58px;
	}
}

.apk365-pn {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 16px;
	clear: both;
	width: 100%;
	float: none;
	box-sizing: border-box;
}

.apk365-pn__item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 14px 16px;
	border-radius: 12px;
	background: #f8fafc;
	text-decoration: none !important;
	color: inherit !important;
	min-width: 0;
	border: 1px solid #e2e8f0;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.apk365-pn__item:hover {
	border-color: #1bbc9b;
	box-shadow: 0 4px 14px rgba(27, 188, 155, 0.12);
}

.apk365-pn__next {
	text-align: right;
	align-items: flex-end;
}

.apk365-pn__dir {
	font-size: 0.75rem;
	font-weight: 600;
	color: #1bbc9b;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.apk365-pn__title {
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.apk365-pn__empty {
	visibility: hidden;
	pointer-events: none;
	border: 0;
	background: transparent;
}

.apk365-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 12px;
}

.apk365-chip {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	border-radius: 999px;
	background: #ecfdf8;
	color: #0f766e !important;
	font-size: 0.8rem;
	font-weight: 600;
	text-decoration: none !important;
}

.apk365-chip:hover {
	background: #1bbc9b;
	color: #fff !important;
}

.apk365-recent {
	margin-top: 16px;
	clear: both;
	width: 100%;
	float: none;
}

.apk365-recent[hidden] {
	display: none !important;
}

.apk365-recent__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 10px;
}

.apk365-recent__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px;
	border-radius: 12px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	text-decoration: none !important;
	color: inherit !important;
	min-width: 0;
}

.apk365-recent__item img {
	width: 48px;
	height: 48px;
	border-radius: 10px;
	object-fit: cover;
	flex-shrink: 0;
}

.apk365-recent__item span {
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: inherit;
}

/* ===== Dark theme contrast (a11y) ===== */
body.theme-dark .apk365-pn__item,
body.theme-dark .apk365-recent__item {
	background: #282d3a;
	border-color: #3a4150;
	color: #f1f5f9 !important;
	box-shadow: none;
}

body.theme-dark .apk365-pn__item:hover,
body.theme-dark .apk365-recent__item:hover {
	border-color: #1bbc9b;
	background: #2f3646;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

body.theme-dark .apk365-pn__dir {
	color: #5eead4;
}

body.theme-dark .apk365-pn__title,
body.theme-dark .apk365-recent__item span {
	color: #f8fafc !important;
}

body.theme-dark .apk365-pn .box-title,
body.theme-dark .apk365-recent .box-title {
	color: #f1f5f9;
}

body.theme-dark .apk365-chip {
	background: rgba(27, 188, 155, 0.18);
	color: #5eead4 !important;
	border: 1px solid rgba(94, 234, 212, 0.35);
}

body.theme-dark .apk365-chip:hover {
	background: #1bbc9b;
	color: #fff !important;
	border-color: #1bbc9b;
}

body.theme-dark .apk365-pn__item:focus-visible,
body.theme-dark .apk365-recent__item:focus-visible,
body.theme-dark .apk365-chip:focus-visible {
	outline: 2px solid #5eead4;
	outline-offset: 2px;
}

body.apk365-in-app .apk365-sticky-dl {
	display: none !important;
}

@media (max-width: 560px) {
	.apk365-pn {
		grid-template-columns: 1fr;
	}

	.apk365-pn__next {
		text-align: left;
		align-items: flex-start;
	}
}
