.spin360-viewer {
	position: relative;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	background: #ffffff;
	user-select: none;
	-webkit-user-select: none;
	touch-action: pan-y;
}

.spin360-stage {
	position: relative;
	width: 100%;
	aspect-ratio: var(--spin360-ratio, 4/3);
	min-height: 280px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	overflow: hidden;
}

.spin360-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
	-webkit-user-drag: none;
	transform-origin: center center;
	transition: transform 0.12s linear;
}

.spin360-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin-top: -17px;
	margin-left: -17px;
	border: 3px solid rgba(0, 0, 0, 0.14);
	border-top-color: rgba(0, 0, 0, 0.72);
	border-radius: 50%;
	animation: spin360-rotate 0.8s linear infinite;
	z-index: 4;
}

@keyframes spin360-rotate { to { transform: rotate(360deg); } }

.spin360-fullscreen,
.spin360-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.98);
	box-shadow: 0 4px 12px rgba(0,0,0,0.14);
	color: #111111;
	font-size: 20px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 30;
	-webkit-appearance: none;
	appearance: none;
}

.spin360-close {
	display: none;
}

.spin360-zoom-controls {
	position: absolute;
	left: 50%;
	bottom: 14px;
	transform: translateX(-50%);
	display: flex;
	gap: 8px;
	align-items: center;
	z-index: 14;
}

.spin360-zoom-btn {
	min-width: 34px;
	height: 30px;
	padding: 0 10px;
	border: none;
	border-radius: 8px;
	background: rgba(255,255,255,0.96);
	box-shadow: 0 4px 12px rgba(0,0,0,0.10);
	color: #111111;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.spin360-overlay {
	position: absolute;
	left: 50%;
	bottom: 56px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px;
	border-radius: 999px;
	background: rgba(66, 66, 76, 0.72);
	color: #ffffff;
	font-size: 15px;
	line-height: 1;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.24s ease, visibility 0.24s ease;
	z-index: 13;
	pointer-events: none;
	white-space: nowrap;
}

.spin360-overlay.is-visible {
	opacity: 1;
	visibility: visible;
}

.spin360-overlay-icon {
	font-size: 22px;
	line-height: 1;
}

.spin360-viewer.is-fullscreen,
.spin360-viewer.spin360-fallback-fullscreen {
	background: #ffffff;
}

.spin360-viewer.is-fullscreen .spin360-stage,
.spin360-viewer.spin360-fallback-fullscreen .spin360-stage {
	width: 100vw;
	height: 100vh;
	aspect-ratio: auto;
	background: #ffffff;
}

.spin360-viewer.is-fullscreen .spin360-close,
.spin360-viewer.spin360-fallback-fullscreen .spin360-close {
	display: inline-flex !important;
	position: absolute !important;
	top: max(12px, env(safe-area-inset-top)) !important;
	right: max(12px, env(safe-area-inset-right)) !important;
	z-index: 999999 !important;
}

.spin360-viewer.spin360-fallback-fullscreen {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	z-index: 999999;
}

body.spin360-body-lock {
	overflow: hidden;
}

.spin360-error {
	padding: 12px 14px;
	background: #fff1f1;
	border: 1px solid #f0b8b8;
	color: #8a1f1f;
	font-size: 14px;
}

@media (max-width: 767px) {
	.spin360-stage {
		min-height: 240px;
	}
	.spin360-fullscreen,
	.spin360-close {
		top: calc(10px + env(safe-area-inset-top));
		right: calc(10px + env(safe-area-inset-right));
		width: 44px;
		height: 44px;
		font-size: 20px;
		z-index: 999999;
	}
	.spin360-zoom-controls {
		bottom: 12px;
		gap: 6px;
	}
	.spin360-zoom-btn {
		min-width: 32px;
		height: 28px;
		font-size: 12px;
		padding: 0 9px;
	}
	.spin360-overlay {
		bottom: 50px;
		max-width: calc(100% - 24px);
		padding: 12px 16px;
		font-size: 14px;
	}
}


/* iPhone fullscreen close button hardening */
.spin360-viewer.is-fullscreen .spin360-close,
.spin360-viewer.spin360-fallback-fullscreen .spin360-close {
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
	mix-blend-mode: normal !important;
	-webkit-transform: translateZ(0) !important;
	transform: translateZ(0) !important;
}

@supports (-webkit-touch-callout: none) {
	.spin360-viewer.is-fullscreen .spin360-close,
	.spin360-viewer.spin360-fallback-fullscreen .spin360-close {
		top: max(16px, env(safe-area-inset-top)) !important;
		right: max(16px, env(safe-area-inset-right)) !important;
		width: 46px !important;
		height: 46px !important;
		font-size: 22px !important;
		z-index: 2147483647 !important;
	}
}


.spin360-zoom-reset-btn {
	gap: 4px;
}

.spin360-reset-icon {
	font-size: 11px;
	line-height: 1;
	opacity: 0.72;
	display: inline-block;
	transform: translateY(-1px);
}

.spin360-reset-text {
	line-height: 1;
}

.spin360-zoom-reset-btn.is-rotating .spin360-reset-icon {
	animation: spin360-reset-rotate 0.32s ease;
}

@keyframes spin360-reset-rotate {
	from { transform: translateY(-1px) rotate(0deg); }
	to { transform: translateY(-1px) rotate(360deg); }
}


.spin360-close-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	font-size: 1em;
}

.spin360-zoom-reset-btn .spin360-reset-icon {
	min-width: 1em;
	text-align: center;
}


.spin360-badge360 {
	position: absolute;
	top: 12px;
	left: 12px;
	min-width: 42px;
	height: 42px;
	padding: 0 10px;
	border-radius: 10px;
	background: rgba(255,255,255,0.96);
	box-shadow: 0 4px 12px rgba(0,0,0,0.10);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 18;
}

.spin360-badge360-text {
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	color: #111111;
	letter-spacing: 0.02em;
}

.spin360-badge360-image,
.spin360-close-image,
.spin360-reset-image {
	display: block;
	width: 18px;
	height: 18px;
	object-fit: contain;
}

.spin360-badge360-image {
	width: 24px;
	height: 24px;
}

.spin360-close-image {
	width: 20px;
	height: 20px;
}

.spin360-zoom-reset-btn.is-rotating .spin360-reset-image {
	animation: spin360-reset-image-rotate 0.42s ease;
}

@keyframes spin360-reset-image-rotate {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
	.spin360-badge360 {
		top: calc(10px + env(safe-area-inset-top));
		left: calc(10px + env(safe-area-inset-left));
		min-width: 40px;
		height: 40px;
		padding: 0 9px;
		z-index: 999998;
	}
}




/* --- Osse patch v1.0.17: controls must stay inside viewer stacking context --- */
.spin360-viewer,
.spin360-stage {
    position: relative;
    isolation: isolate;
    z-index: 0 !important;
}

.spin360-image {
    position: relative;
    z-index: 0 !important;
}

/* Normal page flow: controls stay above image but below page sticky headers/titles */
.spin360-spinner,
.spin360-overlay,
.spin360-zoom-controls,
.spin360-fullscreen,
.spin360-close {
    position: absolute;
    z-index: 1 !important;
}

/* Prevent fullscreen control from floating above unrelated page UI when not fullscreen */
.spin360-viewer:not(.is-fullscreen):not(.spin360-fallback-fullscreen) .spin360-fullscreen,
.spin360-viewer:not(.is-fullscreen):not(.spin360-fallback-fullscreen) .spin360-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 1 !important;
}

/* Mobile normal state */
@media (max-width: 767px) {
    .spin360-viewer:not(.is-fullscreen):not(.spin360-fallback-fullscreen) .spin360-fullscreen,
    .spin360-viewer:not(.is-fullscreen):not(.spin360-fallback-fullscreen) .spin360-close {
        top: calc(10px + env(safe-area-inset-top)) !important;
        right: calc(10px + env(safe-area-inset-right)) !important;
        z-index: 1 !important;
    }
}

/* Only in fullscreen we intentionally elevate controls */
.spin360-viewer.is-fullscreen .spin360-close,
.spin360-viewer.spin360-fallback-fullscreen .spin360-close,
.spin360-viewer.is-fullscreen .spin360-fullscreen,
.spin360-viewer.spin360-fallback-fullscreen .spin360-fullscreen,
.spin360-viewer.is-fullscreen .spin360-zoom-controls,
.spin360-viewer.spin360-fallback-fullscreen .spin360-zoom-controls,
.spin360-viewer.is-fullscreen .spin360-overlay,
.spin360-viewer.spin360-fallback-fullscreen .spin360-overlay,
.spin360-viewer.is-fullscreen .spin360-spinner,
.spin360-viewer.spin360-fallback-fullscreen .spin360-spinner {
    z-index: 20 !important;
}
