.store-chat {
	--spidey-red: #e11d2e;
	--spidey-navy: #0b1438;
	--spidey-blue: #1a2f7a;
	--spidey-ink: #111111;
	--spidey-paper: #fffdf5;
	--spidey-yellow: #ffe566;
	/* Same column as .float-contact (right:16px, 56px buttons, 10px gap) */
	position: fixed;
	right: 16px;
	left: auto;
	bottom: calc(88px + 56px + 10px + 56px + 10px);
	z-index: 1195;
	width: 56px;
	height: 56px;
	overflow: visible;
	font-family: "Comic Neue", "Trebuchet MS", cursive, sans-serif;
}

.store-chat__teaser {
	position: absolute;
	right: 0;
	left: auto;
	bottom: 66px;
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
	gap: 8px;
	width: min(300px, calc(100vw - 28px));
	max-width: min(300px, calc(100vw - 28px));
	animation: store-chat-teaser-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html.store-chat-greet-skip .store-chat__teaser {
	display: none !important;
}

.store-chat.is-open .store-chat__teaser,
.store-chat__teaser.is-dismissed {
	display: none;
}

.store-chat__teaser-bubble {
	appearance: none;
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	border: 3px solid var(--spidey-ink);
	border-radius: 18px 18px 6px 18px;
	background:
		radial-gradient(circle at 12% 18%, rgba(225, 29, 46, 0.12) 0 3px, transparent 4px),
		radial-gradient(circle at 88% 72%, rgba(26, 47, 122, 0.1) 0 2px, transparent 3px),
		linear-gradient(165deg, #ffffff 0%, var(--spidey-paper) 100%);
	color: var(--spidey-ink);
	text-align: left;
	padding: 12px 14px 13px;
	box-shadow:
		4px 4px 0 var(--spidey-ink),
		0 12px 28px rgba(7, 9, 15, 0.2);
	cursor: pointer;
	position: relative;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.store-chat__teaser-bubble:hover {
	transform: translate(-1px, -1px) rotate(-0.5deg);
	box-shadow:
		5px 5px 0 var(--spidey-ink),
		0 14px 30px rgba(7, 9, 15, 0.24);
}

.store-chat__teaser-bubble::after {
	content: "";
	position: absolute;
	right: 20px;
	left: auto;
	bottom: -9px;
	width: 16px;
	height: 16px;
	background: var(--spidey-paper);
	border-right: 3px solid var(--spidey-ink);
	border-bottom: 3px solid var(--spidey-ink);
	border-left: 0;
	transform: rotate(45deg);
	box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.08);
}

.store-chat__teaser-name {
	display: inline-block;
	margin-bottom: 6px;
	padding: 2px 8px;
	border: 2px solid var(--spidey-ink);
	border-radius: 999px;
	background: var(--spidey-yellow);
	font-family: "Bangers", "Impact", sans-serif;
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--spidey-ink);
	white-space: nowrap;
}

.store-chat__teaser-text {
	display: block;
	width: 100%;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--spidey-ink);
	white-space: normal;
	word-break: normal;
	overflow-wrap: break-word;
	writing-mode: horizontal-tb;
	text-orientation: mixed;
}

.store-chat__teaser-text.is-pop {
	animation: store-chat-teaser-pop 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes store-chat-teaser-pop {
	0% {
		opacity: 0;
		transform: translateY(8px) scale(0.94);
	}
	60% {
		opacity: 1;
		transform: translateY(-2px) scale(1.02);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.store-chat__teaser-bubble.is-asking {
	animation: store-chat-teaser-wiggle 0.45s ease;
}

@keyframes store-chat-teaser-wiggle {
	0%, 100% { transform: rotate(0); }
	25% { transform: rotate(-1.5deg) translateY(-1px); }
	75% { transform: rotate(1.5deg) translateY(-1px); }
}

.store-chat__teaser-close {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	margin-top: 2px;
	border: 2px solid var(--spidey-ink);
	border-radius: 50%;
	background: #fff;
	color: var(--spidey-ink);
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	box-shadow: 2px 2px 0 var(--spidey-ink);
}

.store-chat__teaser-close:hover {
	background: var(--spidey-red);
	color: #fff;
}

@keyframes store-chat-teaser-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.92);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (max-width: 575px) {
	.store-chat__teaser {
		right: 0;
		left: auto;
		bottom: 62px;
		width: min(260px, calc(100vw - 24px));
		max-width: min(260px, calc(100vw - 24px));
	}

	.store-chat__teaser-bubble {
		border-radius: 18px 18px 6px 18px;
		padding: 11px 12px 12px;
	}

	.store-chat__teaser-bubble::after {
		right: 16px;
		left: auto;
		bottom: -9px;
		transform: rotate(45deg);
	}

	.store-chat__teaser-text {
		font-size: 13px;
	}
}

.store-chat__launcher {
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	box-shadow:
		0 0 0 2px #111,
		0 0 0 5px rgba(225, 29, 46, 0.35),
		0 8px 18px rgba(7, 9, 15, 0.4);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	padding: 0;
	overflow: visible;
	animation: store-chat-launcher-pulse 2.4s ease-in-out infinite;
}

.store-chat__launcher-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	line-height: 0;
	border-radius: 50%;
	overflow: hidden;
	background: transparent;
	border: 0;
	box-shadow: none;
}

.store-chat__logo-img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	object-position: center center;
	border-radius: 50%;
	transform: none;
	backface-visibility: hidden;
}

.store-chat__logo-img--sm {
	object-position: center center;
	transform: none;
}

.store-chat__logo-icon,
.store-chat__mask-icon {
	width: 56px;
	height: 56px;
	display: block;
}

.store-chat__logo-icon--sm,
.store-chat__mask-icon--sm {
	width: 40px;
	height: 40px;
}

.store-chat__launcher:hover,
.store-chat__launcher:focus {
	background: transparent;
	outline: none;
	transform: translateY(-2px) scale(1.04);
	animation: none;
	box-shadow:
		0 0 0 2px #111,
		0 0 0 6px rgba(225, 29, 46, 0.3),
		0 10px 20px rgba(7, 9, 15, 0.45);
}

@keyframes store-chat-launcher-pulse {
	0%, 100% { box-shadow: 0 0 0 2px #111, 0 0 0 5px rgba(225, 29, 46, 0.35), 0 8px 18px rgba(7, 9, 15, 0.4); }
	50% { box-shadow: 0 0 0 2px #111, 0 0 0 8px rgba(225, 29, 46, 0.16), 0 10px 20px rgba(7, 9, 15, 0.45); }
}

.store-chat__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	box-shadow: none;
	background: transparent;
	flex: 0 0 auto;
	line-height: 0;
}

.store-chat__panel {
	position: absolute;
	right: 0;
	left: auto;
	bottom: 66px;
	width: min(360px, calc(100vw - 24px));
	height: min(480px, calc(100dvh - 160px));
	max-height: min(480px, calc(100dvh - 160px));
	background:
		radial-gradient(circle at 20% 10%, rgba(225, 29, 46, 0.08) 0 2px, transparent 3px),
		radial-gradient(circle at 70% 40%, rgba(26, 47, 122, 0.07) 0 2px, transparent 3px),
		radial-gradient(circle at 40% 80%, rgba(225, 29, 46, 0.06) 0 2px, transparent 3px),
		var(--spidey-paper);
	background-size: 18px 18px, 22px 22px, 16px 16px, auto;
	border: 3px solid var(--spidey-ink);
	border-radius: 6px;
	box-shadow:
		6px 6px 0 var(--spidey-ink),
		0 18px 40px rgba(7, 9, 15, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.store-chat__panel[hidden] {
	display: none !important;
}

.store-chat__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 14px 12px;
	background:
		repeating-linear-gradient(-45deg, transparent 0 8px, rgba(255, 255, 255, 0.04) 8px 9px),
		linear-gradient(110deg, #0b1438 0%, #1a2f7a 45%, #9b0f1c 100%);
	border-bottom: 4px solid var(--spidey-yellow);
	color: #fff;
}

.store-chat__identity {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.store-chat__avatar {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	box-shadow: none;
	overflow: hidden;
	line-height: 0;
}

.store-chat__title {
	display: block;
	font-family: "Bangers", "Impact", sans-serif;
	font-size: 1.35rem;
	font-weight: 400;
	letter-spacing: 0.06em;
	text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}

.store-chat__subtitle {
	margin: 2px 0 0;
	font-size: 12px;
	font-weight: 700;
	opacity: 0.92;
}

.store-chat__close {
	border: 2px solid #fff;
	background: rgba(0, 0, 0, 0.25);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	width: 30px;
	height: 30px;
	border-radius: 4px;
	box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}

.store-chat__close:hover {
	background: var(--spidey-red);
}

.store-chat__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px 14px;
	background: transparent;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.store-chat__bubble {
	position: relative;
	max-width: 88%;
	padding: 11px 13px 12px;
	border-radius: 16px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-word;
	border: 3px solid var(--spidey-ink);
	box-shadow: 3px 3px 0 var(--spidey-ink);
}

.store-chat__bubble--bot {
	align-self: flex-start;
	background: #fff;
	color: var(--spidey-ink);
	border-radius: 18px 18px 18px 6px;
}

.store-chat__bubble--bot::before {
	content: "SPIDEY";
	display: inline-block;
	margin: 0 0 6px;
	padding: 1px 7px;
	border: 2px solid var(--spidey-ink);
	border-radius: 999px;
	background: var(--spidey-yellow);
	font-family: "Bangers", "Impact", sans-serif;
	font-size: 11px;
	font-weight: 400;
	letter-spacing: 0.08em;
	color: var(--spidey-ink);
}

.store-chat__bubble--user {
	align-self: flex-end;
	background: linear-gradient(145deg, #2a47a8, #1a2f7a);
	color: #fff;
	border-radius: 18px 18px 6px 18px;
	border-color: var(--spidey-ink);
}

.store-chat__bubble--muted {
	align-self: flex-start;
	background: transparent;
	border: 0;
	box-shadow: none;
	color: #64748b;
	font-size: 13px;
	font-weight: 700;
	padding: 0 4px;
}

.store-chat__bubble--muted::before {
	display: none;
}

.store-chat__products {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 2px;
}

.store-chat__product {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	background: #eff6ff;
	color: #1e3a5f;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	border: 1px solid #bfdbfe;
}

.store-chat__product-thumb {
	width: 52px;
	height: 52px;
	flex-shrink: 0;
	object-fit: contain;
	border-radius: 6px;
	background: #fff;
	border: 1px solid #dbeafe;
}

.store-chat__product-info {
	flex: 1;
	min-width: 0;
}

.store-chat__product:hover {
	background: #dbeafe;
	color: #152238;
}

.store-chat__product-slot {
	display: block;
	font-style: normal;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #64748b;
	margin-bottom: 2px;
}

.store-chat__product-name {
	display: block;
	font-weight: 600;
	color: #1e3a5f;
}

.store-chat__product-meta,
.store-chat__product span {
	display: block;
	font-weight: 500;
	color: #475569;
	margin-top: 2px;
}

.store-chat__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-self: stretch;
	margin-top: 2px;
}

.store-chat__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 8px 12px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid #bfdbfe;
	background: #eff6ff;
	color: #1e3a5f;
}

.store-chat__action--link {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #fff;
}

.store-chat__action--link:hover {
	background: #1e40af;
	color: #fff;
}

.store-chat__action--send:hover {
	background: #dbeafe;
}

.store-chat__build {
	align-self: stretch;
	background: #fff;
	border: 1px solid #dbe3ef;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
	margin-top: 2px;
}

.store-chat__build-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 12px 10px;
	background: linear-gradient(135deg, #1e3a5f 0%, #274a73 100%);
	color: #fff;
}

.store-chat__build-title {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.store-chat__build-total {
	font-size: 13px;
	font-weight: 700;
	white-space: nowrap;
	background: rgba(255, 255, 255, 0.14);
	padding: 4px 8px;
	border-radius: 999px;
}

.store-chat__build-list {
	display: flex;
	flex-direction: column;
}

.store-chat__build-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	text-decoration: none;
	color: inherit;
	border-top: 1px solid #eef2f7;
	transition: background 0.15s ease;
}

.store-chat__build-row:first-child {
	border-top: 0;
}

a.store-chat__build-row:hover {
	background: #f1f5f9;
}

.store-chat__build-row-main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.store-chat__build-slot {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #64748b;
}

.store-chat__build-name {
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.35;
	color: #1e293b;
}

.store-chat__build-price {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 700;
	color: #1d4ed8;
	white-space: nowrap;
	padding-top: 14px;
}

.store-chat__build-usage {
	padding: 10px 12px 12px;
	border-top: 1px solid #eef2f7;
	background: #f8fafc;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.store-chat__build-usage-row {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.store-chat__build-usage-row strong {
	font-size: 10px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #64748b;
}

.store-chat__build-usage-row span {
	font-size: 12.5px;
	line-height: 1.4;
	color: #1e293b;
}

.store-chat__build-actions {
	padding: 10px 12px 12px;
	border-top: 1px solid #eef2f7;
	background: #f8fafc;
}

.store-chat__build-btn {
	display: block;
	text-align: center;
	padding: 10px 12px;
	border-radius: 8px;
	background: #1d4ed8;
	color: #fff !important;
	text-decoration: none;
	font-size: 13px;
	font-weight: 700;
}

.store-chat__build-btn:hover {
	background: #1e40af;
}

.store-chat__form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 3px solid var(--spidey-ink);
	background: #fff7d6;
}

.store-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 42px;
	border: 3px solid var(--spidey-ink);
	border-radius: 10px;
	padding: 0 12px;
	font-family: "Comic Neue", "Trebuchet MS", cursive, sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: var(--spidey-ink);
	background: #fff;
	box-shadow: 2px 2px 0 var(--spidey-ink);
}

.store-chat__input:focus {
	outline: 0;
	border-color: var(--spidey-red);
	box-shadow: 3px 3px 0 var(--spidey-ink);
}

.store-chat__send {
	flex: 0 0 auto;
	height: 42px;
	padding: 0 16px;
	border: 3px solid var(--spidey-ink);
	border-radius: 10px;
	background: var(--spidey-red);
	color: #fff;
	font-family: "Bangers", "Impact", sans-serif;
	font-weight: 400;
	font-size: 16px;
	letter-spacing: 0.06em;
	cursor: pointer;
	box-shadow: 3px 3px 0 var(--spidey-ink);
}

.store-chat__send:hover {
	background: #ff2d3f;
	transform: translate(-1px, -1px);
	box-shadow: 4px 4px 0 var(--spidey-ink);
}

.store-chat__send:disabled {
	opacity: 0.6;
	cursor: wait;
}

.store-chat__fallback {
	padding: 10px 12px 12px;
	border-top: 1px solid #c5d9cf;
	background: #eef6f1;
}

.store-chat__fallback[hidden] {
	display: none !important;
}

.store-chat__fallback-title {
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 600;
	color: #0f2f28;
}

.store-chat__fallback-hint {
	margin: 0 0 8px;
	font-size: 12px;
	color: #3d5c52;
	line-height: 1.4;
}

.store-chat__fallback-form {
	display: flex;
	gap: 8px;
}

.store-chat__fallback-input {
	flex: 1;
	min-width: 0;
	height: 36px;
	border: 1px solid #b7d0c4;
	border-radius: 8px;
	padding: 0 10px;
	font-size: 13px;
}

.store-chat__fallback-btn {
	height: 36px;
	padding: 0 12px;
	border: 0;
	border-radius: 8px;
	background: #e11d2e;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

@media (max-width: 991px) {
	.store-chat {
		right: 12px;
		left: auto;
		/* Match .float-contact mobile: right 12px, 52px buttons @ bottom 78px */
		bottom: calc(78px + 52px + 10px + 52px + 10px);
		width: 52px;
		height: 52px;
	}

	.store-chat__launcher,
	.store-chat__launcher-mark,
	.store-chat__logo-icon,
	.store-chat__mask-icon {
		width: 52px;
		height: 52px;
	}
}

@media (max-width: 991px) {
	body:has(.product-mobile-bar.is-visible) .store-chat {
		/* Match float-contact lift when sticky buy bar is visible */
		bottom: calc(56px + 65px + 16px + 52px + 10px + 52px + 10px + env(safe-area-inset-bottom, 0px));
	}

	/* Compact sheet anchored to the visual viewport (keyboard-safe) */
	.store-chat.is-open .store-chat__panel {
		position: fixed;
		left: 10px;
		right: 10px;
		width: auto;
		max-width: none;
		bottom: calc(var(--store-chat-kb-inset, 0px) + 10px + env(safe-area-inset-bottom, 0px));
		top: auto;
		height: auto;
		max-height: min(520px, calc(var(--store-chat-vvh, 100dvh) - 20px));
		min-height: 280px;
		border-radius: 14px;
		z-index: 1300;
		transform: none;
	}

	.store-chat.is-open .store-chat__launcher {
		opacity: 0;
		pointer-events: none;
	}

	.store-chat__head {
		padding: 10px 12px;
		gap: 8px;
	}

	.store-chat__avatar {
		width: 36px;
		height: 36px;
	}

	.store-chat__title {
		font-size: 1.1rem;
	}

	.store-chat__subtitle {
		font-size: 11px;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.store-chat__messages {
		padding: 12px;
		gap: 10px;
		min-height: 0;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	.store-chat__bubble {
		font-size: 13px;
		padding: 9px 11px 10px;
		max-width: 92%;
	}

	.store-chat__form {
		padding: 10px;
		gap: 6px;
		flex-shrink: 0;
	}

	.store-chat__input,
	.store-chat__send {
		height: 40px;
	}
}

/* Short desktop windows / laptops */
@media (max-height: 760px) and (min-width: 992px) {
	.store-chat__panel {
		height: min(420px, calc(100dvh - 120px));
		max-height: min(420px, calc(100dvh - 120px));
		width: min(340px, calc(100vw - 24px));
	}
}

@media (max-height: 640px) {
	.store-chat.is-open .store-chat__panel,
	.store-chat__panel {
		height: min(360px, calc(var(--store-chat-vvh, 100dvh) - 16px));
		max-height: calc(var(--store-chat-vvh, 100dvh) - 16px);
	}

	.store-chat__subtitle {
		display: none;
	}
}

/* Prevent page jump/scroll while chat is open on phones */
@media (max-width: 991px) {
	body.store-chat-open {
		overflow: hidden;
		touch-action: none;
	}
}
