/* Forces Brands — Floating Helper Mascot "Bolt" (Phase 29A + 29B)
 * Scoped to .fb-helper. No global side-effects.
 */

/* =============================================================================
   Root container — fixed bottom-right
   ============================================================================= */

.fb-helper {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 9990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	font-family: var(--fb-font-body, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif);
	-webkit-font-smoothing: antialiased;
}

/* =============================================================================
   Mascot toggle button
   ============================================================================= */

.fb-helper__mascot {
	position: relative;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: transparent;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: none;
	transition: transform 0.2s ease;
	overflow: visible;
	padding: 0;
}

.fb-helper__mascot:hover {
	transform: translateY( -4px ) scale( 1.06 );
}

.fb-helper__mascot:active {
	transform: translateY( -1px ) scale( 1.02 );
}

.fb-helper__mascot:focus-visible {
	outline: 3px solid var(--fb-brass-soft);
	outline-offset: 4px;
}

/* =============================================================================
   Character image inside button
   ============================================================================= */

.fb-helper__character {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.fb-helper__character img {
	width: 68px;
	height: auto;
	display: block;
	object-fit: contain;
	position: relative;
	z-index: 1;
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
	filter: drop-shadow( 0 12px 22px rgba( 15, 59, 130, 0.30 ) );
	transition: filter 0.2s ease;
}

/* =============================================================================
   Next-step nudge — gentle, dismissible pointer above the mascot
   ============================================================================= */

.fb-helper__nudge {
	position: absolute;
	right: 4px;
	bottom: 84px;
	display: flex;
	align-items: flex-start;
	gap: 6px;
	width: min( 240px, calc( 100vw - 32px ) );
	opacity: 0;
	transform: translateY( 8px ) scale( 0.96 );
	transform-origin: bottom right;
	transition: opacity 0.22s ease, transform 0.22s ease;
	pointer-events: none;
	z-index: 2;
}

.fb-helper__nudge.is-visible {
	opacity: 1;
	transform: translateY( 0 ) scale( 1 );
	pointer-events: auto;
}

.fb-helper__nudge-body {
	display: inline-flex;
	flex: 1 1 auto;
	align-items: center;
	gap: 8px;
	background: var(--fb-surface);
	color: var(--fb-ink);
	border: 1.5px solid rgba( 124, 192, 255, 0.30 );
	border-radius: 16px 16px 4px 16px;
	padding: 10px 14px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	text-align: left;
	cursor: pointer;
	box-shadow: 0 12px 28px rgba( 8, 22, 55, 0.35 );
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.fb-helper__nudge-body:hover {
	border-color: var(--fb-azure, #7cc0ff );
	transform: translateY( -1px );
}

.fb-helper__nudge-arrow {
	color: var(--fb-azure, #7cc0ff );
	font-weight: 800;
	flex-shrink: 0;
}

.fb-helper__nudge-dismiss {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	margin-top: 2px;
	border-radius: 50%;
	border: 1px solid var(--fb-border);
	background: var(--fb-surface);
	color: var(--fb-ink-soft);
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.fb-helper__nudge-dismiss:hover {
	color: var(--fb-ink);
	border-color: var(--fb-azure, #7cc0ff );
}

@media (max-width: 600px) {
	.fb-helper__nudge-body { font-size: 12px; padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.fb-helper__nudge { transition: opacity 0.01s linear; }
	.fb-helper__nudge.is-visible { transform: none; }
}

/* =============================================================================
   "Need help?" speech bubble
   ============================================================================= */

.fb-helper__bubble {
	position: absolute;
	bottom: 76px;
	right: 0;
	background: var(--fb-surface);
	border: 1.5px solid rgba(124,192,255,0.30);
	border-radius: 16px 16px 4px 16px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--fb-azure);
	white-space: nowrap;
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.12 );
	opacity: 0;
	transform: translateY( 8px );
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
	cursor: pointer;
}

.fb-helper__bubble--visible {
	opacity: 1;
	transform: translateY( 0 );
	pointer-events: auto;
}

/* Tail of the speech bubble */
.fb-helper__bubble::after {
	content: '';
	position: absolute;
	bottom: -9px;
	right: 14px;
	border-left: 7px solid transparent;
	border-right: 3px solid transparent;
	border-top: 9px solid var(--fb-surface);
	filter: drop-shadow( 0 2px 2px rgba( 0,0,0,0.08 ) );
}

/* =============================================================================
   Help panel
   ============================================================================= */

.fb-helper__panel {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 340px;
	background: var(--fb-surface);
	border-radius: 16px;
	box-shadow:
		0 10px 40px rgba( 0, 0, 0, 0.16 ),
		0 2px 8px rgba( 0, 0, 0, 0.08 );
	border: 1px solid var(--fb-border);
	overflow: hidden;
	animation: fb-panel-in 0.25s cubic-bezier( 0.34, 1.56, 0.64, 1 ) both;
}

@keyframes fb-panel-in {
	from {
		opacity: 0;
		transform: translateY( 14px ) scale( 0.95 );
	}
	to {
		opacity: 1;
		transform: translateY( 0 ) scale( 1 );
	}
}

/* Panel header */
.fb-helper__panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px 12px 16px;
	background: linear-gradient( 135deg, var(--fb-green) 0%, var(--fb-green-dark) 100% );
}

.fb-helper__panel-header-inner {
	display: flex;
	align-items: center;
	gap: 10px;
}

.fb-helper__panel-mascot {
	width: 38px;
	height: 38px;
	object-fit: contain;
	display: block;
	flex-shrink: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.92 );
	padding: 3px;
	box-sizing: border-box;
}

.fb-helper__panel-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
	line-height: 1.2;
}

/* Close button */
.fb-helper__close {
	background: rgba( 255, 255, 255, 0.15 );
	border: 1px solid rgba( 255, 255, 255, 0.25 );
	color: rgba( 255, 255, 255, 0.9 );
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
	transition: background 0.15s ease, color 0.15s ease;
	flex-shrink: 0;
}

.fb-helper__close:hover {
	background: rgba( 255, 255, 255, 0.28 );
	color: #ffffff;
}

.fb-helper__close:focus-visible {
	outline: 2px solid rgba( 255, 255, 255, 0.9 );
	outline-offset: 2px;
}

/* Panel body */
.fb-helper__panel-body {
	padding: 16px;
	font-size: 14px;
	color: var(--fb-ink);
	line-height: 1.6;
	max-height: 460px;
	overflow-y: auto;
}

.fb-helper__panel-body p {
	margin: 0 0 12px;
}

.fb-helper__panel-body p:last-child {
	margin-bottom: 0;
}

/* =============================================================================
   Mobile responsive
   ============================================================================= */

@media ( max-width: 480px ) {
	.fb-helper {
		right: 12px;
		bottom: 12px;
	}

	.fb-helper__panel {
		width: calc( 100vw - 24px );
		right: 0;
		bottom: 84px;
	}

	.fb-helper__mascot {
		width: 64px;
		height: 64px;
	}

	.fb-helper__character img {
		width: 56px;
	}
}

/* =============================================================================
   Reduced motion
   ============================================================================= */

@media ( prefers-reduced-motion: reduce ) {
	.fb-helper__mascot,
	.fb-helper__bubble,
	.fb-helper__panel {
		transition: none !important;
		animation: none !important;
	}
}

/* =============================================================================
   Phase 29B — Contextual Help Content
   ============================================================================= */

/* Intro paragraph */
.fb-helper__intro {
	margin: 0 0 14px;
	font-size: 13.5px;
	color: var(--fb-ink-soft);
	line-height: 1.6;
}

/* Tips list */
.fb-helper__tips {
	list-style: none;
	margin: 0 0 14px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fb-helper__tip {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 13px;
	color: var(--fb-ink);
	line-height: 1.55;
	padding: 8px 10px;
	background: var(--fb-accent-bg);
	border-left: 3px solid var(--fb-green);
	border-radius: 0 6px 6px 0;
}

.fb-helper__tip::before {
	content: '⚡';
	font-size: 12px;
	flex-shrink: 0;
	line-height: 1.55;
}

/* Quick action buttons */
.fb-helper__actions {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 4px;
}

.fb-helper__action-btn {
	display: block;
	padding: 9px 14px;
	background: var(--fb-green);
	color: #ffffff;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: background 0.15s ease, transform 0.15s ease;
}

.fb-helper__action-btn:hover {
	background: var(--fb-green-dark);
	color: #ffffff;
	transform: translateY( -1px );
	text-decoration: none;
}

.fb-helper__action-btn:focus-visible {
	outline: 3px solid var(--fb-brass-soft);
	outline-offset: 2px;
}

.fb-helper__action-btn + .fb-helper__action-btn {
	background: var(--fb-sand);
	color: var(--fb-azure);
	border: 1px solid rgba(124,192,255,0.30);
}

.fb-helper__action-btn + .fb-helper__action-btn:hover {
	background: var(--fb-accent-bg);
	color: var(--fb-azure);
}

/* Temporary flash tip (from fbHelper.showTip) */
.fb-helper__tip-flash {
	background: rgba(245,158,11,0.16);
	border: 1.5px solid rgba(245,158,11,0.35);
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 13px;
	color: #fbbf24;
	margin-bottom: 12px;
	animation: fb-tip-flash-in 0.3s ease both;
}

@keyframes fb-tip-flash-in {
	from { opacity: 0; transform: translateY( -6px ); }
	to   { opacity: 1; transform: translateY( 0 ); }
}

/* =============================================================================
   Phase 29C — Gesture Animation and Microinteraction System
   ============================================================================= */

/* Idle bob — always running on the mascot button (slow, calm float) */
.fb-helper__mascot {
	animation: fb-bob 3s ease-in-out infinite;
}

@keyframes fb-bob {
	0%, 100% { transform: translateY( 0 ) rotate( 0deg ); }
	30%       { transform: translateY( -4px ) rotate( -0.5deg ); }
	50%       { transform: translateY( -6px ) rotate( 0.3deg ); }
	75%       { transform: translateY( -3px ) rotate( -0.2deg ); }
}

/* Swoosh entrance — one-time on load */
.fb-helper--entering .fb-helper__mascot {
	animation: fb-swoosh-in 0.65s cubic-bezier( 0.34, 1.56, 0.64, 1 ) both;
}

@keyframes fb-swoosh-in {
	0%   { transform: translateY( 100px ) scale( 0.4 ); opacity: 0; }
	60%  { transform: translateY( -10px ) scale( 1.08 ); opacity: 1; }
	80%  { transform: translateY( 4px ) scale( 0.97 ); }
	100% { transform: translateY( 0 ) scale( 1 ); }
}

/* Wave gesture */
.fb-helper--gesture-wave .fb-helper__mascot {
	animation: fb-wave 1.2s ease both;
}

@keyframes fb-wave {
	0%   { transform: translateY( 0 ) rotate( 0deg ); }
	15%  { transform: translateY( -10px ) rotate( 14deg ); }
	30%  { transform: translateY( -12px ) rotate( -10deg ); }
	50%  { transform: translateY( -10px ) rotate( 12deg ); }
	70%  { transform: translateY( -6px ) rotate( -6deg ); }
	85%  { transform: translateY( -3px ) rotate( 4deg ); }
	100% { transform: translateY( 0 ) rotate( 0deg ); }
}

/* Success / jump gesture */
.fb-helper--gesture-success .fb-helper__mascot {
	animation: fb-success 0.9s cubic-bezier( 0.36, 0.07, 0.19, 0.97 ) both;
}

@keyframes fb-success {
	0%   { transform: translateY( 0 ) scale( 1 ); }
	20%  { transform: translateY( -22px ) scale( 1.12 ); }
	40%  { transform: translateY( -24px ) scale( 1.15 ); }
	55%  { transform: translateY( -10px ) scale( 1.05 ); }
	70%  { transform: translateY( -16px ) scale( 1.08 ); }
	85%  { transform: translateY( -4px ) scale( 1.02 ); }
	100% { transform: translateY( 0 ) scale( 1 ); }
}

/* Warning / shake gesture */
.fb-helper--gesture-warning .fb-helper__mascot {
	animation: fb-shake 0.7s ease both;
}

@keyframes fb-shake {
	0%, 100% { transform: translateX( 0 ); }
	15%       { transform: translateX( -9px ); }
	30%       { transform: translateX( 9px ); }
	45%       { transform: translateX( -7px ); }
	60%       { transform: translateX( 7px ); }
	75%       { transform: translateX( -4px ); }
	88%       { transform: translateX( 3px ); }
}

/* Thinking gesture — slow tilt left/right */
.fb-helper--gesture-thinking .fb-helper__mascot {
	animation: fb-think 2s ease-in-out both;
}

@keyframes fb-think {
	0%   { transform: rotate( 0deg ) translateY( 0 ); }
	20%  { transform: rotate( -7deg ) translateY( -3px ); }
	40%  { transform: rotate( -9deg ) translateY( -4px ); }
	60%  { transform: rotate( 5deg ) translateY( -2px ); }
	80%  { transform: rotate( 3deg ) translateY( -1px ); }
	100% { transform: rotate( 0deg ) translateY( 0 ); }
}

/* Point / guide gesture — lean forward */
.fb-helper--gesture-point .fb-helper__mascot {
	animation: fb-point 1.4s ease both;
}

@keyframes fb-point {
	0%   { transform: translateX( 0 ) translateY( 0 ) rotate( 0deg ); }
	25%  { transform: translateX( -8px ) translateY( -6px ) rotate( -8deg ); }
	50%  { transform: translateX( -10px ) translateY( -8px ) rotate( -10deg ); }
	75%  { transform: translateX( -5px ) translateY( -3px ) rotate( -4deg ); }
	100% { transform: translateX( 0 ) translateY( 0 ) rotate( 0deg ); }
}

/* Sparkles — injected by JS as .fb-helper__spark */
.fb-helper__spark {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fbbf24;
	pointer-events: none;
	animation: fb-spark 0.65s ease-out both;
	transform-origin: center center;
}

@keyframes fb-spark {
	0% {
		opacity: 1;
		transform: translate( -50%, -50% ) rotate( var( --angle ) ) translateY( 0 ) scale( 1 );
	}
	100% {
		opacity: 0;
		transform: translate( -50%, -50% ) rotate( var( --angle ) ) translateY( -36px ) scale( 0.2 );
	}
}

/* Mascot button: keep overflow visible for sparkles */
.fb-helper__mascot {
	overflow: visible;
}

/* Reduced motion overrides for gesture animations */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper__mascot {
		animation: none !important;
	}
	.fb-helper--gesture-wave .fb-helper__mascot,
	.fb-helper--gesture-success .fb-helper__mascot,
	.fb-helper--gesture-warning .fb-helper__mascot,
	.fb-helper--gesture-thinking .fb-helper__mascot,
	.fb-helper--gesture-point .fb-helper__mascot,
	.fb-helper--entering .fb-helper__mascot {
		animation: none !important;
		transform: none !important;
	}
	.fb-helper__spark {
		display: none !important;
	}
}

/* =============================================================================
   Phase 29D — Guided Tours
   ============================================================================= */

/* Target highlight — applied to the element being focused by the tour */
.fb-helper-tour-target {
	outline: 3px solid var(--fb-green) !important;
	outline-offset: 4px !important;
	box-shadow: 0 0 0 6px rgba( 59, 130, 246, 0.18 ) !important;
	border-radius: 6px;
	position: relative;
	z-index: 100;
	transition: outline 0.2s ease, box-shadow 0.2s ease;
}

/* Tour container inside panel body */
.fb-helper__tour {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Progress dots */
.fb-helper__tour-progress {
	display: flex;
	gap: 5px;
	margin-bottom: 2px;
}

.fb-helper__tour-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--fb-green-soft);
	display: inline-block;
	transition: background 0.2s ease;
}

.fb-helper__tour-dot--active {
	background: var(--fb-green);
}

/* Step label */
.fb-helper__tour-step-label {
	margin: 0;
	font-size: 11px;
	font-weight: 600;
	color: var(--fb-ink-soft);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* Tour heading */
.fb-helper__tour-title {
	margin: 0;
	font-size: 14.5px;
	font-weight: 700;
	color: var(--fb-ink);
	line-height: 1.3;
}

/* Tour body text */
.fb-helper__tour-body {
	margin: 0;
	font-size: 13px;
	color: var(--fb-ink);
	line-height: 1.6;
}

/* Controls row */
.fb-helper__tour-controls {
	display: flex;
	gap: 8px;
	margin-top: 4px;
}

.fb-helper__tour-btn {
	flex: 1;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition: background 0.15s ease, transform 0.15s ease;
	text-align: center;
}

.fb-helper__tour-btn--back {
	background: var(--fb-sand);
	color: var(--fb-azure);
	border: 1px solid rgba(124,192,255,0.30);
}

.fb-helper__tour-btn--back:hover {
	background: var(--fb-accent-bg);
}

.fb-helper__tour-btn--next,
.fb-helper__tour-btn--done {
	background: var(--fb-green);
	color: #ffffff;
}

.fb-helper__tour-btn--next:hover,
.fb-helper__tour-btn--done:hover {
	background: var(--fb-green-dark);
	transform: translateY( -1px );
}

.fb-helper__tour-btn:focus-visible {
	outline: 3px solid var(--fb-brass-soft);
	outline-offset: 2px;
}

/* Skip link */
.fb-helper__tour-skip {
	background: none;
	border: none;
	padding: 2px 0;
	font-size: 12px;
	color: var(--fb-ink-soft);
	cursor: pointer;
	text-align: left;
	text-decoration: underline;
	text-underline-offset: 2px;
	transition: color 0.15s ease;
	align-self: flex-start;
}

.fb-helper__tour-skip:hover {
	color: var(--fb-ink-soft);
}

.fb-helper__tour-skip:focus-visible {
	outline: 2px solid var(--fb-brass-soft);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Mobile — tour controls full width */
@media ( max-width: 480px ) {
	.fb-helper__tour-controls {
		flex-direction: column;
	}
}

/* Reduced motion — no highlight transition */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper-tour-target {
		transition: none !important;
	}
	.fb-helper__tour-btn {
		transition: none !important;
	}
}

/* =============================================================================
   Phase 29E — Polish, Accessibility, and Performance
   ============================================================================= */

/* GPU promotion hint for continuously-animated mascot */
.fb-helper__mascot {
	will-change: transform;
}

/* Modal-open state — dim helper so it doesn't compete with blocking UI */
.fb-helper--modal-open {
	opacity: 0.25;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

/* Tour target on mobile — prevent horizontal overflow from wide outlines */
@media ( max-width: 480px ) {
	.fb-helper-tour-target {
		outline-offset: 2px !important;
	}
}

/* Panel viewport safety clamp — prevents overflow on short screens */
.fb-helper__panel-body {
	-webkit-overflow-scrolling: touch;
}

/* Reduce motion — disable modal-open transition */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper--modal-open {
		transition: none !important;
	}
}

/* =============================================================================
   Phase 29H — Mascot Visual Polish and Microanimation Improvements
   ============================================================================= */

/* Shadow breathing on the character image, synced to idle bob timing */
.fb-helper__character img {
	animation: fb-bob-shadow 3s ease-in-out infinite;
}

@keyframes fb-bob-shadow {
	0%, 100% { filter: drop-shadow( 0 12px 22px rgba( 15, 59, 130, 0.30 ) ); }
	30%       { filter: drop-shadow( 0 16px 26px rgba( 15, 59, 130, 0.36 ) ); }
	50%       { filter: drop-shadow( 0 20px 32px rgba( 15, 59, 130, 0.42 ) ); }
	75%       { filter: drop-shadow( 0 14px 24px rgba( 15, 59, 130, 0.33 ) ); }
}

/* Deeper glow on hover */
.fb-helper__mascot:hover .fb-helper__character img {
	filter: drop-shadow( 0 18px 32px rgba( 15, 59, 130, 0.50 ) );
	animation: none;
}

/* Amber pulse for warning state (complements existing shake) */
.fb-helper--gesture-warning .fb-helper__character img {
	filter:
		drop-shadow( 0 12px 22px rgba( 15, 59, 130, 0.30 ) )
		drop-shadow( 0 0 12px rgba( 245, 158, 11, 0.55 ) );
}

/* Success — golden sparkle tint on top of existing jump animation */
.fb-helper--gesture-success .fb-helper__character img {
	filter:
		drop-shadow( 0 12px 22px rgba( 15, 59, 130, 0.30 ) )
		drop-shadow( 0 0 16px rgba( 251, 191, 36, 0.60 ) );
}

/* Thinking — softer blue pulse */
.fb-helper--gesture-thinking .fb-helper__character img {
	animation: fb-think-glow 2s ease-in-out both;
}

@keyframes fb-think-glow {
	0%   { filter: drop-shadow( 0 12px 22px rgba( 15, 59, 130, 0.30 ) ); }
	40%  { filter: drop-shadow( 0 12px 22px rgba( 37, 99, 235, 0.55 ) ); }
	100% { filter: drop-shadow( 0 12px 22px rgba( 15, 59, 130, 0.30 ) ); }
}

/* Reduced motion — freeze shadow breathing, keep static shadow */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper__character img {
		animation: none !important;
		filter: drop-shadow( 0 10px 18px rgba( 15, 59, 130, 0.28 ) ) !important;
	}
	.fb-helper--gesture-warning .fb-helper__character img,
	.fb-helper--gesture-success .fb-helper__character img,
	.fb-helper--gesture-thinking .fb-helper__character img {
		filter: drop-shadow( 0 10px 18px rgba( 15, 59, 130, 0.28 ) ) !important;
		animation: none !important;
	}
}

/* =============================================================================
   Phase 29I — Chat-like Flow UI
   ============================================================================= */

/* Outer container for a flow conversation */
.fb-helper-chat {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Chat feed — options and nav are inside this container (Phase 29Z) */
.fb-helper-chat__messages {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Base chat bubble */
.fb-helper-chat__msg {
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.5;
	max-width: 92%;
	word-wrap: break-word;
}

/* Assistant bubble — left aligned */
.fb-helper-chat__msg--assistant {
	background: var(--fb-accent-bg);
	color: var(--fb-azure);
	border: 1px solid rgba(124,192,255,0.30);
	border-bottom-left-radius: 3px;
	align-self: flex-start;
}

/* User selection confirmation — right aligned */
.fb-helper-chat__msg--user {
	background: var(--fb-green);
	color: #ffffff;
	border-bottom-right-radius: 3px;
	align-self: flex-end;
	text-align: right;
	font-weight: 600;
}

/* Success message — green tint */
.fb-helper-chat__msg--success {
	background: rgba(74,222,128,0.14);
	color: var(--fb-success);
	border: 1px solid rgba(74,222,128,0.35);
	border-bottom-left-radius: 3px;
	align-self: flex-start;
}

/* Step card (platform instructions) */
.fb-helper-chat__steps {
	background: var(--fb-sand);
	border: 1px solid var(--fb-border);
	border-radius: 10px;
	padding: 12px 14px;
}

.fb-helper-chat__step-list {
	margin: 0;
	padding: 0 0 0 20px;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.fb-helper-chat__step-item {
	font-size: 12.5px;
	color: var(--fb-ink);
	line-height: 1.55;
}

.fb-helper-chat__note {
	margin: 10px 0 0;
	font-size: 12px;
	color: var(--fb-ink-soft);
	line-height: 1.5;
	padding-top: 8px;
	border-top: 1px solid var(--fb-border);
}

/* Screenshot placeholder */
.fb-helper-chat__screenshot--placeholder {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	padding: 8px 10px;
	background: var(--fb-sand);
	border: 1px dashed var(--fb-border);
	border-radius: 8px;
	font-size: 12px;
	color: var(--fb-ink-soft);
	line-height: 1.4;
}

.fb-helper-chat__screenshot-icon {
	font-size: 15px;
	flex-shrink: 0;
}

/* Screenshot image (for future real screenshots) */
.fb-helper-chat__screenshot-img {
	width: 100%;
	max-height: 120px;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid var(--fb-border);
	display: block;
	margin-top: 10px;
}

/* Option buttons container — now inside the scrollable feed */
.fb-helper-chat__options {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-top: 10px;
}

/* Option / action button */
.fb-helper-chat__opt-btn {
	width: 100%;
	padding: 9px 14px;
	background: var(--fb-sand);
	color: var(--fb-azure);
	border: 1px solid rgba(124,192,255,0.30);
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.12s ease;
	text-decoration: none;
	display: block;
	line-height: 1.4;
}

.fb-helper-chat__opt-btn:hover {
	background: var(--fb-accent-bg);
	transform: translateY( -1px );
	text-decoration: none;
	color: var(--fb-azure);
}

.fb-helper-chat__opt-btn:focus-visible {
	outline: 3px solid var(--fb-brass-soft);
	outline-offset: 2px;
}

.fb-helper-chat__opt-btn--primary {
	background: var(--fb-green);
	color: #ffffff;
	border-color: var(--fb-green);
}

.fb-helper-chat__opt-btn--primary:hover {
	background: var(--fb-green-dark);
	color: #ffffff;
}

/* Back / Restart nav row */
.fb-helper-chat__nav {
	display: flex;
	justify-content: space-between;
	padding-top: 8px;
	margin-top: 2px;
	border-top: 1px solid var(--fb-border);
}

.fb-helper-chat__nav-btn {
	background: none;
	border: none;
	padding: 2px 0;
	font-size: 12px;
	color: var(--fb-ink-soft);
	cursor: pointer;
	transition: color 0.15s ease;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.fb-helper-chat__nav-btn:hover {
	color: var(--fb-ink-soft);
}

.fb-helper-chat__nav-btn:focus-visible {
	outline: 2px solid var(--fb-brass-soft);
	border-radius: 2px;
	outline-offset: 2px;
}

.fb-helper-chat__nav-btn--restart {
	color: var(--fb-green-soft);
}

/* ChatGPT handoff card */
.fb-helper-chat__handoff {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fb-helper-chat__handoff-label {
	font-size: 12.5px;
	color: var(--fb-ink-soft);
	margin: 0;
}

.fb-helper-chat__handoff-prompt {
	background: var(--fb-sand);
	border: 1px solid var(--fb-border);
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 12px;
	color: var(--fb-ink);
	line-height: 1.6;
	white-space: pre-wrap;
	word-break: break-word;
	font-family: inherit;
	max-height: 100px;
	overflow-y: auto;
	user-select: text;
}

.fb-helper-chat__handoff-actions {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

/* Fallback textarea — shown if clipboard fails */
.fb-helper-chat__handoff-fallback {
	display: none;
	width: 100%;
	height: 72px;
	font-size: 11.5px;
	font-family: inherit;
	border: 1px solid var(--fb-border);
	border-radius: 6px;
	padding: 6px 8px;
	color: var(--fb-ink);
	resize: vertical;
	box-sizing: border-box;
}

/* Mobile */
@media ( max-width: 480px ) {
	.fb-helper-chat__messages {
		max-height: 160px;
	}
}

/* Reduced motion */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper-chat__opt-btn {
		transition: none !important;
		transform: none !important;
	}
}

/* =============================================================================
   Phase 29K — Seamless Conversation UX: typing animation
   ============================================================================= */

/* Typing indicator bubble — same style as assistant, but contains animated dots */
.fb-helper-chat__msg--typing {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 10px 14px;
	min-width: 52px;
}

/* Visually hidden screen-reader label */
.fb-helper-chat__typing-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* Individual dots */
.fb-helper-chat__typing-dot {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--fb-brass-soft);
	animation: fb-typing-bounce 1.1s ease-in-out infinite;
	flex-shrink: 0;
}

.fb-helper-chat__typing-dot:nth-child( 2 ) {
	animation-delay: 0.18s;
}

.fb-helper-chat__typing-dot:nth-child( 3 ) {
	animation-delay: 0.36s;
}

@keyframes fb-typing-bounce {
	0%, 55%, 100% {
		transform: translateY( 0 );
		opacity: 0.45;
	}
	27% {
		transform: translateY( -5px );
		opacity: 1;
	}
}

/* Reduced motion — freeze dots, keep them visible */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper-chat__typing-dot {
		animation: none !important;
		opacity: 0.5;
	}
}

/* =============================================================================
   Phase 29M — Seamless Single Chat Stream
   ============================================================================= */

/* Subtle fade-in on each innerHTML replacement to remove the white-flash */
.fb-helper-chat {
	animation: fb-chat-in 0.12s ease both;
}

@keyframes fb-chat-in {
	from { opacity: 0.65; }
	to   { opacity: 1; }
}

@media ( prefers-reduced-motion: reduce ) {
	.fb-helper-chat {
		animation: none !important;
	}
}

/* =============================================================================
   Phase 29N — Navigation and Escape Routes
   ============================================================================= */

/* Secondary navigation buttons — subdued, clearly lower priority than primary */
.fb-helper-chat__opt-btn--secondary {
	background: transparent;
	color: var(--fb-ink-soft);
	border-color: var(--fb-border);
	font-weight: 500;
	font-size: 12.5px;
}

.fb-helper-chat__opt-btn--secondary:hover {
	background: var(--fb-sand);
	color: var(--fb-ink-soft);
}

/* =============================================================================
   Phase 29O — One-Click ChatGPT Handoff
   ============================================================================= */

/* =============================================================================
   Phase 29R — Bolt Helper Full UI/UX Polish
   ============================================================================= */

/* Screenshot toggle — subtle ghost button */
.fb-helper-chat__screenshot-toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-top: 8px;
	background: none;
	border: 1px solid var(--fb-border);
	border-radius: 6px;
	padding: 4px 10px;
	font-size: 11.5px;
	color: var(--fb-ink-soft);
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
	font-family: inherit;
}

.fb-helper-chat__screenshot-toggle:hover {
	color: var(--fb-ink-soft);
	border-color: var(--fb-border);
}

.fb-helper-chat__screenshot-toggle:focus-visible {
	outline: 2px solid var(--fb-brass-soft);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Increase panel body max-height for longer column-guidance messages */
.fb-helper__panel-body {
	max-height: 520px;
}

/* Mobile: larger max-height so options don't disappear off screen */
@media ( max-width: 480px ) {
	.fb-helper__panel-body {
		max-height: calc( 100vh - 140px );
	}

	.fb-helper-chat__opt-btn {
		padding: 11px 14px;
	}
}

/* Reduced motion */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper-chat__screenshot-toggle {
		transition: none !important;
	}
}

/* Feedback message shown after one-click button fires */
.fb-helper-chat__handoff-feedback {
	background: rgba(74,222,128,0.14);
	border: 1px solid rgba(74,222,128,0.35);
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 12.5px;
	color: var(--fb-success);
	line-height: 1.55;
	margin: 0;
}

/* Phase 29Y — thin scrollbar for panel body and message history */
.fb-helper__panel-body {
	scrollbar-width: thin;
	scrollbar-color: var(--fb-border-strong) var(--fb-sand);
}

.fb-helper__panel-body::-webkit-scrollbar {
	width: 4px;
}

.fb-helper__panel-body::-webkit-scrollbar-track {
	background: var(--fb-sand);
}

.fb-helper__panel-body::-webkit-scrollbar-thumb {
	background: var(--fb-brass-soft);
	border-radius: 4px;
}

/* =============================================================================
   Phase 30I — Animated Bolt Dashboard Tour
   ============================================================================= */

/* Mascot moves near the highlighted target via CSS custom property translation */
.fb-helper--tour-active .fb-helper__mascot {
	transform: translate( var( --fb-bolt-tour-x, 0px ), var( --fb-bolt-tour-y, 0px ) );
	transition: transform 0.5s cubic-bezier( 0.34, 1.56, 0.64, 1 );
	position: relative;
	z-index: 10000;
}

/* Return to corner */
.fb-helper--tour-returning .fb-helper__mascot {
	transform: translate( 0, 0 );
	transition: transform 0.42s ease;
}

/* Arrival bounce — applied to the character inside the button */
.fb-helper--tour-at-target .fb-helper__character {
	animation: fb-bolt-bounce 0.45s ease both;
}

@keyframes fb-bolt-bounce {
	0%   { transform: scale( 1 ); }
	35%  { transform: scale( 1.14 ); }
	65%  { transform: scale( 0.94 ); }
	100% { transform: scale( 1 ); }
}

/* Tour target highlight ring + pulse */
.fb-helper-tour-target--active {
	outline: 3px solid var(--fb-green) !important;
	outline-offset: 4px !important;
	border-radius: 8px;
	position: relative;
	z-index: 100;
	animation: fb-tour-pulse 1.6s ease infinite;
}

@keyframes fb-tour-pulse {
	0%, 100% {
		box-shadow:
			0 0 0 5px rgba( 59, 130, 246, 0.14 ),
			0 0 18px rgba( 59, 130, 246, 0.18 );
	}
	50% {
		box-shadow:
			0 0 0 8px rgba( 59, 130, 246, 0.24 ),
			0 0 26px rgba( 59, 130, 246, 0.28 );
	}
}

/* Tour step body text — slightly larger for readability */
.fb-helper__tour-body {
	font-size: 13.5px;
	line-height: 1.58;
	color: var(--fb-ink);
}

/* Focus rings for tour controls (accessibility) */
.fb-helper__tour-btn:focus-visible,
.fb-helper__tour-skip:focus-visible {
	outline: 2px solid var(--fb-brass-soft);
	outline-offset: 2px;
	border-radius: 6px;
}

/* =============================================================================
   Phase 30L — Reduced motion + Accessibility
   ============================================================================= */

@media ( prefers-reduced-motion: reduce ) {
	/* Bolt stays in corner — no translate animation */
	.fb-helper--tour-active .fb-helper__mascot,
	.fb-helper--tour-returning .fb-helper__mascot {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}

	/* No bounce */
	.fb-helper--tour-at-target .fb-helper__character {
		animation: none !important;
	}

	/* Highlight: static ring only, no pulse */
	.fb-helper-tour-target--active {
		animation: none !important;
		box-shadow:
			0 0 0 4px rgba( 59, 130, 246, 0.35 ) !important;
	}

	/* Suppress mascot hover/active transforms during tour */
	.fb-helper--tour-active .fb-helper__mascot:hover,
	.fb-helper--tour-active .fb-helper__mascot:active {
		transform: none !important;
	}
}

/* .fb-helper-chat__messages no longer scrolls (Phase 29Z) — scrollbar styles removed */

/* ==========================================================================
   Phase 30M — Bolt speech bubble (sprite intro)
   ========================================================================== */

.fb-helper__speech {
	position: fixed;
	bottom: 130px;
	right: 20px;
	max-width: 280px;
	background: var(--fb-surface);
	border: 1px solid var(--fb-border);
	border-radius: 12px;
	padding: 14px 16px;
	box-shadow: 0 4px 20px rgba( 0, 0, 0, 0.12 );
	z-index: 10001;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

/* JS repositions via inline left/top; these are the corner defaults */
.fb-helper__speech[hidden] {
	display: none;
}

/* Tail pointer toward Bolt (points downward by default) */
.fb-helper__speech::after {
	content: '';
	position: absolute;
	bottom: -8px;
	right: 28px;
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-top: 8px solid var(--fb-surface);
	filter: drop-shadow( 0 2px 1px rgba( 0, 0, 0, 0.06 ) );
}

.fb-helper__speech-title {
	margin: 0 0 4px;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--fb-ink);
	line-height: 1.3;
}

.fb-helper__speech-text {
	margin: 0 0 12px;
	font-size: 0.85rem;
	color: var(--fb-ink);
	line-height: 1.45;
}

.fb-helper__speech-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.fb-helper__speech-btn {
	border: none;
	border-radius: 6px;
	padding: 7px 14px;
	font-size: 0.82rem;
	font-weight: 500;
	cursor: pointer;
	line-height: 1.2;
}

.fb-helper__speech-btn--primary {
	background: var(--fb-green);
	color: #fff;
}

.fb-helper__speech-btn--primary:hover,
.fb-helper__speech-btn--primary:focus-visible {
	background: var(--fb-blue);
	outline: 2px solid var(--fb-green);
	outline-offset: 2px;
}

.fb-helper__speech-btn--secondary {
	background: var(--fb-sand);
	color: var(--fb-ink);
}

.fb-helper__speech-btn--secondary:hover,
.fb-helper__speech-btn--secondary:focus-visible {
	background: var(--fb-khaki);
	outline: 2px solid var(--fb-ink-soft);
	outline-offset: 2px;
}

/* Mobile: stretch to full width above Bolt */
@media ( max-width: 639px ) {
	.fb-helper__speech {
		right: 10px;
		left: 10px;
		max-width: none;
		bottom: 110px;
	}

	.fb-helper__speech::after {
		right: 30px;
	}
}

/* Reduced motion: suppress entry transition */
@media ( prefers-reduced-motion: reduce ) {
	.fb-helper__speech {
		transition: none !important;
	}
}

/* Phase 41C — "Open this area" tour link */
.fb-helper__tour-btn--open {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin-top: 6px;
	padding: 7px 12px;
	background: rgba(74,222,128,0.14);
	color: var(--fb-success);
	border: 1px solid rgba(74,222,128,0.35);
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.fb-helper__tour-btn--open:hover {
	background: rgba(74,222,128,0.14);
	color: var(--fb-success);
	text-decoration: none;
}

/* Phase 41B — vendor-welcome: enlarged Bolt panel with backdrop */
.fb-helper[data-page-context="vendor-welcome"].fb-helper--open .fb-helper__panel {
	width: min( 440px, 92vw );
}

.fb-helper[data-page-context="vendor-welcome"].fb-helper--open::before {
	content: '';
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.22 );
	z-index: 9989;
	pointer-events: none;
}

/* =============================================================================
   Phase 42G — Welcome overlay and Bolt centre slide
   ============================================================================= */

/* Bolt slides from bottom-right to viewport centre */
.fb-helper--welcome-centered {
	transition:
		bottom 0.8s cubic-bezier( 0.34, 1.56, 0.64, 1 ),
		right  0.8s cubic-bezier( 0.34, 1.56, 0.64, 1 );
	bottom: calc( 50vh - 36px ) !important;
	right:  calc( 50vw - 36px ) !important;
}

/* Full-page backdrop while welcome sequence plays */
.fb-helper--welcome-overlay::before {
	content: '';
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.45 );
	z-index: 9989;
	pointer-events: none;
}

@media ( prefers-reduced-motion: reduce ) {
	.fb-helper--welcome-centered {
		transition: none !important;
	}
}
