.csp-modal[hidden] {
	display: none !important;
}

.csp-modal {
	--csp-surface: var(--color-surface, #ffffff);
	--csp-bg: var(--color-bg, #121218);
	--csp-bg-alt: var(--color-bg-alt, #1a1a22);
	--csp-primary: var(--color-primary, #9b59b6);
	--csp-primary-dark: var(--color-primary-dark, #7d3c98);
	--csp-primary-light: var(--color-primary-light, #f5e9ff);
	--csp-accent: var(--color-accent, #ff921c);
	--csp-text: var(--color-text, #f3f4f7);
	--csp-text-muted: var(--color-text-muted, #c6cad4);
	--csp-radius-lg: var(--radius-lg, 14px);
	--csp-radius-md: var(--radius-md, 10px);
	--csp-shadow: var(--shadow-lg, 0 16px 40px rgba(0, 0, 0, 0.38));
	--csp-shadow-glow: var(--shadow-glow, 0 8px 20px rgba(255, 146, 28, 0.28));
}

.csp-modal {
	position: fixed;
	inset: 0;
	/* 高于 admin bar(99999)、主题 sticky/抽屉，避免被页脚或下方区块盖住 */
	z-index: 500000;
}

.csp-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
}

.csp-modal__dialog {
	position: relative;
	width: min(840px, calc(100% - 32px));
	max-height: calc(100vh - 48px);
	margin: 24px auto;
	background: var(--csp-bg);
	color: var(--csp-text);
	border: 1px solid rgba(155, 89, 182, 0.35);
	border-radius: var(--csp-radius-lg);
	box-shadow: var(--csp-shadow);
	overflow: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--scrollbar-thumb-color, rgba(155, 89, 182, 0.78)) var(--scrollbar-track, rgba(25, 18, 36, 0.92));
}

.csp-modal__toolbar {
	position: sticky;
	top: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 12px;
	background: linear-gradient(135deg, rgba(18, 18, 24, 0.96), rgba(26, 26, 34, 0.96));
	border-bottom: 1px solid rgba(155, 89, 182, 0.28);
	backdrop-filter: blur(6px);
}

.csp-modal__toolbar-group {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.csp-modal__toolbar-group--nav {
	flex: 1 1 auto;
}

.csp-modal__close,
.csp-modal__nav {
	height: 34px;
	padding: 0 12px;
	border-radius: 999px;
	border: 1px solid var(--csp-primary);
	background: linear-gradient(135deg, var(--csp-primary), var(--csp-primary-dark));
	color: #ffffff;
	cursor: pointer;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	transition: all 0.18s ease;
	white-space: nowrap;
}

.csp-modal__close:hover,
.csp-modal__nav:hover {
	background: linear-gradient(135deg, var(--csp-primary-light), var(--csp-primary));
	box-shadow: var(--csp-shadow-glow);
}

.csp-modal__nav[disabled] {
	opacity: 1;
	cursor: not-allowed;
	box-shadow: none;
	border-color: rgba(255, 255, 255, 0.25);
	background: rgba(255, 255, 255, 0.14);
	color: rgba(255, 255, 255, 0.62);
}

.csp-modal__close {
	min-width: 34px;
	padding: 0;
	font-size: 18px;
	border-color: var(--csp-accent);
	background: linear-gradient(135deg, var(--csp-accent), #ff7f11);
	color: #1f1300;
}

.csp-modal__close:hover {
	background: linear-gradient(135deg, #ffd59b, var(--csp-accent));
	box-shadow: 0 0 0 2px rgba(255, 146, 28, 0.24);
}

.csp-modal__meta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 70px;
	height: 28px;
	padding: 0 10px;
	border-radius: 999px;
	border: 1px solid rgba(155, 89, 182, 0.35);
	background: rgba(155, 89, 182, 0.16);
	color: #f6f2ff;
	font-size: 12px;
	font-weight: 700;
}

.csp-modal__body {
	padding: 10px 14px 14px;
}

.csp-modal-loading,
.csp-modal-error {
	padding: 18px 14px;
	border: 1px solid rgba(155, 89, 182, 0.22);
	border-radius: var(--csp-radius-md);
	background: rgba(255, 255, 255, 0.04);
	color: var(--csp-text);
	font-weight: 600;
	text-align: center;
}

.csp-modal-error {
	border-color: rgba(255, 146, 28, 0.35);
	color: #ffd59b;
}

.csp-post-modal-content__media {
	max-width: 620px;
	margin: 0 auto;
}

.csp-post-modal-content__media img,
.csp-post-modal-content__media video {
	display: block;
	width: 100%;
	border-radius: 10px;
}

.csp-post-modal-content__embed iframe {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 5;
	border: 0;
	border-radius: 10px;
	background: #0d0d12;
}

.csp-post-modal-content__embed--instagram iframe {
	min-height: 520px;
	aspect-ratio: auto;
	background: var(--csp-surface);
	max-width: 520px;
	width: 100%;
	border-radius: 3px;
	border: 1px solid rgba(155, 89, 182, 0.24);
	box-shadow: none;
	margin: 0 auto;
}

.csp-post-modal-content__embed--instagram-official {
	max-width: 540px;
	margin: 0 auto;
}

.csp-post-modal-content__embed--instagram-official .instagram-media {
	margin: 0 auto !important;
	min-width: 0 !important;
	width: 100% !important;
}

.csp-post-modal-content__embed--instagram-official.is-fallback .instagram-media {
	display: none !important;
}

.csp-instagram-embed-fallback {
	max-width: 520px;
	margin: 0 auto;
}

.csp-instagram-embed-fallback img {
	display: block;
	width: 100%;
	border-radius: 10px;
}

.csp-instagram-embed-fallback__link {
	display: inline-block;
	margin-top: 10px;
	color: var(--csp-primary-light);
	font-weight: 700;
	text-decoration: none;
}

.csp-instagram-embed-fallback__link:hover {
	color: var(--csp-accent);
}

.csp-post-modal-content__image-fallback {
	display: none;
	width: 100%;
	border-radius: 10px;
}

.csp-post-modal-content__comments {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid rgba(155, 89, 182, 0.26);
}

.csp-post-modal-content__info {
	margin-top: 12px;
	background: var(--csp-surface);
	color: var(--csp-text);
	border: 1px solid rgba(155, 89, 182, 0.18);
	border-radius: var(--csp-radius-md);
	padding: 10px 12px;
}

.csp-post-modal-content__cta a {
	display: inline-block;
	color: var(--csp-primary-light);
	font-weight: 700;
	text-decoration: none;
}

.csp-post-modal-content__cta a:hover {
	color: var(--csp-accent);
}

.csp-post-modal-content__platform,
.csp-post-modal-content__date {
	color: var(--csp-text-muted);
}

.csp-post-modal-content__author {
	margin: 4px 0 0;
	color: #ffffff;
}

.csp-post-modal-content__engagement {
	font-weight: 700;
	margin: 8px 0 2px;
}

.csp-post-modal-content__caption {
	margin-top: 8px;
	line-height: 1.55;
	max-height: 240px;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-word;
}

.csp-post-modal-content__comments pre {
	max-height: 220px;
	overflow: auto;
	background: #fff;
	padding: 10px;
	border-radius: 8px;
}

.csp-comments-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 8px;
}

.csp-comments-list li {
	background: var(--csp-surface);
	border: 1px solid rgba(155, 89, 182, 0.16);
	border-radius: 8px;
	padding: 8px 10px;
	color: #1f2430;
}

.csp-comments-raw {
	max-height: 220px;
	overflow: auto;
	background: var(--csp-surface);
	border: 1px solid rgba(155, 89, 182, 0.16);
	border-radius: 8px;
	padding: 10px;
	white-space: pre-wrap;
	word-break: break-word;
	color: #1f2430;
}

.csp-modal__dialog,
.csp-post-modal-content__caption,
.csp-post-modal-content__comments pre,
.csp-comments-raw {
	scrollbar-width: thin;
	scrollbar-color: var(--scrollbar-thumb-color, rgba(155, 89, 182, 0.78)) var(--scrollbar-track, rgba(25, 18, 36, 0.92));
}

.csp-modal__dialog::-webkit-scrollbar,
.csp-post-modal-content__caption::-webkit-scrollbar,
.csp-post-modal-content__comments pre::-webkit-scrollbar,
.csp-comments-raw::-webkit-scrollbar {
	width: var(--scrollbar-size, 8px);
	height: var(--scrollbar-size, 8px);
}

.csp-modal__dialog::-webkit-scrollbar-track,
.csp-post-modal-content__caption::-webkit-scrollbar-track,
.csp-post-modal-content__comments pre::-webkit-scrollbar-track,
.csp-comments-raw::-webkit-scrollbar-track {
	background: var(--scrollbar-track, rgba(25, 18, 36, 0.92));
	border-radius: 999px;
}

.csp-modal__dialog::-webkit-scrollbar-thumb,
.csp-post-modal-content__caption::-webkit-scrollbar-thumb,
.csp-post-modal-content__comments pre::-webkit-scrollbar-thumb,
.csp-comments-raw::-webkit-scrollbar-thumb {
	background: var(--scrollbar-thumb, linear-gradient(90deg, rgba(125, 60, 152, 0.9), rgba(155, 89, 182, 0.86)));
	border-radius: 999px;
}

.csp-modal__dialog::-webkit-scrollbar-thumb:hover,
.csp-post-modal-content__caption::-webkit-scrollbar-thumb:hover,
.csp-post-modal-content__comments pre::-webkit-scrollbar-thumb:hover,
.csp-comments-raw::-webkit-scrollbar-thumb:hover {
	background: var(--scrollbar-thumb-hover, linear-gradient(90deg, rgba(155, 89, 182, 0.95), rgba(187, 119, 214, 0.9)));
}

.csp-post-modal-content__related {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid rgba(155, 89, 182, 0.26);
}

.csp-post-modal-content__related-title {
	margin: 0 0 8px;
	font-size: 0.98rem;
	font-weight: 700;
	color: #ffffff;
}

.csp-related-products-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.csp-related-product-card {
	display: grid;
	gap: 10px;
	background: linear-gradient(145deg, rgba(21, 16, 34, 0.96), rgba(14, 18, 42, 0.96));
	border: 1px solid rgba(155, 89, 182, 0.32);
	border-radius: var(--csp-radius-md);
	padding: 10px;
	max-width: 520px;
	box-shadow: 0 10px 24px rgba(7, 6, 15, 0.34);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.csp-related-product-card:hover,
.csp-related-product-card:focus-within {
	transform: translateY(-1px);
	border-color: rgba(155, 89, 182, 0.56);
	box-shadow: 0 14px 30px rgba(7, 6, 15, 0.42);
}

.csp-related-product-main {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	text-decoration: none;
	color: var(--csp-text);
	min-width: 0;
}

.csp-related-product-thumb {
	display: block;
	width: 96px;
	height: 96px;
	border-radius: 10px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(255, 255, 255, 0.03);
}

.csp-related-product-main:hover {
	text-decoration: none;
}

.csp-related-product-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.28s ease;
}

.csp-related-product-card:hover .csp-related-product-thumb img,
.csp-related-product-card:focus-within .csp-related-product-thumb img {
	transform: scale(1.04);
}

.csp-related-product-summary {
	display: grid;
	gap: 4px;
	min-width: 0;
}

.csp-related-product-title {
	display: block;
	font-size: 0.96rem;
	line-height: 1.38;
	font-weight: 700;
	margin-top: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.64em;
	color: #ffffff;
}

.csp-related-product-price {
	display: block;
	font-size: 0.88rem;
	line-height: 1.35;
	color: #f8f6ff;
}

.csp-related-product-price .amount {
	font-weight: 700;
	color: #f8f6ff;
}

.csp-related-product-price ins {
	text-decoration: none;
}

.csp-related-product-price del {
	margin-right: 6px;
	opacity: 0.62;
}

.csp-related-product-stock {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
	border: 1px solid transparent;
}

.csp-related-product-stock.is-in-stock {
	background: rgba(34, 197, 94, 0.16);
	border-color: rgba(74, 222, 128, 0.38);
	color: #bbf7d0;
}

.csp-related-product-stock.is-out-of-stock {
	background: rgba(251, 146, 60, 0.16);
	border-color: rgba(251, 146, 60, 0.34);
	color: #fed7aa;
}

.csp-related-product-actions {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.csp-related-product-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 8px 10px;
	border-radius: 10px;
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
	border: 1px solid rgba(155, 89, 182, 0.34);
	transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.csp-related-product-action--view {
	background: rgba(255, 255, 255, 0.08);
	color: #ebe3ff;
}

.csp-related-product-action--cart {
	background: linear-gradient(135deg, rgba(125, 60, 152, 0.96), rgba(155, 89, 182, 0.94));
	border-color: rgba(255, 255, 255, 0.08);
	color: #fff;
}

.csp-related-product-action:hover,
.csp-related-product-action:focus-visible {
	transform: translateY(-1px);
	border-color: rgba(255, 255, 255, 0.42);
}

.csp-related-product-action--cart:hover,
.csp-related-product-action--cart:focus-visible {
	background: linear-gradient(135deg, rgba(155, 89, 182, 0.98), rgba(187, 119, 214, 0.96));
	color: #fff;
}

.csp-related-product-action--disabled {
	background: rgba(255, 255, 255, 0.09);
	border-color: rgba(255, 255, 255, 0.2);
	color: rgba(255, 255, 255, 0.66);
	cursor: not-allowed;
}

body.csp-modal-open {
	overflow: hidden;
}

@media (max-width: 768px) {
	.csp-modal__dialog {
		width: calc(100% - 12px);
		max-height: calc(100vh - 12px);
		margin: 6px auto;
		border-radius: 10px;
	}

	.csp-modal__toolbar {
		padding: 6px 8px;
		gap: 6px;
	}

	.csp-modal__close,
	.csp-modal__nav {
		height: 32px;
		padding: 0 9px;
		font-size: 11px;
	}

	.csp-modal__close {
		min-width: 32px;
		font-size: 17px;
	}

	.csp-modal__btn-text {
		display: none;
	}

	.csp-modal__meta {
		min-width: 56px;
		height: 26px;
		padding: 0 8px;
		font-size: 11px;
	}

	.csp-modal__body {
		padding: 8px 10px 12px;
	}

	.csp-post-modal-content__embed--instagram iframe {
		min-height: 430px;
		max-width: 100%;
	}

	.csp-related-products-grid {
		grid-template-columns: 1fr;
	}

	.csp-related-product-card {
		gap: 8px;
		max-width: 100%;
		padding: 8px;
	}

	.csp-related-product-main {
		grid-template-columns: 74px minmax(0, 1fr);
		gap: 9px;
	}

	.csp-related-product-thumb {
		width: 74px;
		height: 74px;
	}

	.csp-related-product-title {
		font-size: 0.86rem;
		min-height: 2.4em;
	}

	.csp-related-product-price {
		font-size: 0.8rem;
	}

	.csp-related-product-actions {
		grid-template-columns: 1fr 1fr;
		gap: 6px;
	}

	.csp-related-product-action {
		min-height: 34px;
		padding: 7px 8px;
		font-size: 11px;
	}
}

