/* ==========================================================================
   AI Face Swap Tool — scoped styles
   Every rule is namespaced under .afsw-root and every custom property is
   prefixed --afsw- so this can never bleed into (or be overridden by) a
   theme or another plugin's global styles.
   ========================================================================== */

.afsw-root {
	--afsw-bg: #0b0e14;
	--afsw-surface: #12151f;
	--afsw-surface-2: #171b28;
	--afsw-border: rgba(255, 255, 255, 0.08);
	--afsw-border-soft: rgba(255, 255, 255, 0.05);
	--afsw-text: #eef0f4;
	--afsw-text-muted: #8b93a7;
	--afsw-text-faint: #565d70;
	--afsw-accent: #7c5cfc;
	--afsw-accent-2: #22d3ee;
	--afsw-accent-grad: linear-gradient(135deg, #7c5cfc 0%, #22d3ee 100%);
	--afsw-success: #2ee6a6;
	--afsw-danger: #ff5c7a;
	--afsw-radius-sm: 10px;
	--afsw-radius: 16px;
	--afsw-radius-lg: 22px;
	--afsw-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
	--afsw-font-display: 'Space Grotesk', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
	--afsw-font-body: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
	--afsw-font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
	--afsw-ease: cubic-bezier(0.4, 0, 0.2, 1);

	all: initial;
	display: block;
	font-family: var(--afsw-font-body);
	color: var(--afsw-text);
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
	container-type: inline-size;
	container-name: afswroot;
}

.afsw-root *,
.afsw-root *::before,
.afsw-root *::after {
	box-sizing: border-box;
	font-family: inherit;
}

.afsw-root button {
	font: inherit;
}

/* ---------------------------------------------------------------------- */
/* Container                                                               */
/* ---------------------------------------------------------------------- */

.afsw-container {
	position: relative;
	width: 100%;
	max-width: 980px;
	margin: 0 auto;
	padding: clamp(16px, 3vw, 32px);
	background:
		radial-gradient(circle at 15% 0%, rgba(124, 92, 252, 0.10), transparent 45%),
		radial-gradient(circle at 100% 20%, rgba(34, 211, 238, 0.08), transparent 40%),
		var(--afsw-bg);
	border: 1px solid var(--afsw-border);
	border-radius: var(--afsw-radius-lg);
	box-shadow: var(--afsw-shadow);
	overflow: hidden;
	isolation: isolate;
}

.afsw-mesh {
	position: absolute;
	inset: -20%;
	z-index: -1;
	pointer-events: none;
	opacity: 0.55;
	filter: blur(8px);
}

.afsw-mesh span {
	position: absolute;
	width: 42%;
	height: 42%;
	border-radius: 50%;
	filter: blur(60px);
	animation: afsw-drift 22s ease-in-out infinite;
}

.afsw-mesh span:nth-child(1) {
	top: 5%;
	left: 0%;
	background: radial-gradient(circle, rgba(124, 92, 252, 0.35), transparent 70%);
	animation-delay: 0s;
}

.afsw-mesh span:nth-child(2) {
	top: 40%;
	right: 0%;
	background: radial-gradient(circle, rgba(34, 211, 238, 0.28), transparent 70%);
	animation-delay: -7s;
	animation-duration: 26s;
}

.afsw-mesh span:nth-child(3) {
	bottom: 0%;
	left: 25%;
	background: radial-gradient(circle, rgba(255, 101, 132, 0.2), transparent 70%);
	animation-delay: -14s;
	animation-duration: 30s;
}

@keyframes afsw-drift {
	0%, 100% { transform: translate(0, 0) scale(1); }
	33% { transform: translate(6%, 8%) scale(1.08); }
	66% { transform: translate(-5%, -4%) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
	.afsw-mesh span {
		animation: none;
	}
}

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.afsw-header {
	position: relative;
	text-align: center;
	padding: clamp(24px, 4vw, 40px) clamp(12px, 2vw, 20px) clamp(20px, 3vw, 32px);
}

.afsw-header-bg {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border-radius: inherit;
	pointer-events: none;
	z-index: 0;
}

.afsw-header-glow {
	position: absolute;
	inset: -40% -10% auto -10%;
	height: 220px;
	background: var(--afsw-accent-grad);
	filter: blur(80px);
	opacity: 0.18;
	pointer-events: none;
}

/* ---------------------------------------------------------------------- */
/* Background color switcher                                              */
/* ---------------------------------------------------------------------- */

.afsw-theme-switcher {
	position: absolute;
	top: clamp(14px, 2vw, 20px);
	right: clamp(14px, 2vw, 20px);
	z-index: 5;
}

.afsw-theme-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	min-width: 38px;
	min-height: 38px;
	border-radius: 50%;
	border: 1px solid var(--afsw-border);
	background: var(--afsw-surface);
	color: var(--afsw-text-muted);
	cursor: pointer;
	transition: all 0.2s var(--afsw-ease);
	flex-shrink: 0;
}

.afsw-theme-toggle:hover,
.afsw-theme-toggle[aria-expanded="true"] {
	color: var(--afsw-text);
	border-color: var(--afsw-accent);
	transform: rotate(20deg);
}

.afsw-theme-toggle:focus-visible {
	outline: 2px solid var(--afsw-accent-2);
	outline-offset: 2px;
}

.afsw-theme-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 200px;
	max-width: min(220px, calc(100cqi - 24px), 88vw);
	padding: 14px;
	background: var(--afsw-surface);
	border: 1px solid var(--afsw-border);
	border-radius: var(--afsw-radius-sm);
	box-shadow: var(--afsw-shadow);
	animation: afsw-fade-up 0.2s var(--afsw-ease);
	z-index: 10;
}

.afsw-theme-panel[hidden] {
	display: none;
}

.afsw-theme-panel-title {
	margin: 0 0 10px;
	font-family: var(--afsw-font-mono);
	font-size: 10.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--afsw-text-faint);
}

.afsw-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.afsw-swatch {
	position: relative;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 2px solid var(--afsw-border);
	background: var(--sw, #0b0e14);
	cursor: pointer;
	padding: 0;
	transition: transform 0.15s var(--afsw-ease), border-color 0.15s var(--afsw-ease);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex-shrink: 0;
}

.afsw-swatch:focus-visible {
	outline: 2px solid var(--afsw-accent-2);
	outline-offset: 2px;
}

.afsw-swatch:hover {
	transform: scale(1.1);
}

.afsw-swatch.afsw-active {
	border-color: var(--afsw-accent-2);
	box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.25);
}

.afsw-swatch-custom {
	background: conic-gradient(from 180deg, #ff5c7a, #ffd166, #2ee6a6, #22d3ee, #7c5cfc, #ff5c7a);
}

.afsw-swatch-custom input[type="color"] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	border: none;
	padding: 0;
}

.afsw-theme-reset {
	margin-top: 12px;
	width: 100%;
	background: none;
	border: none;
	color: var(--afsw-text-faint);
	font-size: 11.5px;
	text-decoration: underline;
	cursor: pointer;
	padding: 0;
	text-align: left;
}

.afsw-theme-reset:hover {
	color: var(--afsw-text);
}

@media (max-width: 480px) {
	.afsw-theme-switcher {
		position: static;
		display: flex;
		justify-content: center;
		margin-bottom: 12px;
	}

	.afsw-theme-panel {
		right: auto;
		left: 50%;
		transform: translateX(-50%);
	}
}

@container afswroot (max-width: 480px) {
	.afsw-theme-switcher {
		position: static;
		display: flex;
		justify-content: center;
		margin-bottom: 12px;
	}

	.afsw-theme-panel {
		right: auto;
		left: 50%;
		transform: translateX(-50%);
	}
}

.afsw-eyebrow {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--afsw-font-mono);
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--afsw-accent-2);
	background: rgba(34, 211, 238, 0.08);
	border: 1px solid rgba(34, 211, 238, 0.25);
	padding: 6px 12px;
	border-radius: 999px;
	margin-bottom: 16px;
}

.afsw-eyebrow-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--afsw-accent-2);
	box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.6);
	animation: afsw-pulse-dot 2s var(--afsw-ease) infinite;
}

@keyframes afsw-pulse-dot {
	0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.55); }
	70% { box-shadow: 0 0 0 8px rgba(34, 211, 238, 0); }
	100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}

.afsw-title {
	position: relative;
	font-family: var(--afsw-font-display);
	font-weight: 700;
	font-size: clamp(26px, 4vw, 40px);
	letter-spacing: -0.02em;
	line-height: 1.1;
	margin: 0 0 8px;
	background: linear-gradient(135deg, #ffffff 30%, #b6b0ff 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.afsw-subtitle {
	position: relative;
	margin: 0;
	color: var(--afsw-text-muted);
	font-size: clamp(14px, 1.6vw, 16px);
	max-width: 46ch;
	margin-inline: auto;
}

/* ---------------------------------------------------------------------- */
/* Trust chips                                                            */
/* ---------------------------------------------------------------------- */

.afsw-chips {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
}

.afsw-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	font-size: 12px;
	font-weight: 500;
	color: var(--afsw-text-muted);
	background: color-mix(in srgb, var(--afsw-surface) 80%, transparent);
	border: 1px solid var(--afsw-border-soft);
	border-radius: 999px;
}

.afsw-chip-ico {
	font-size: 12px;
	line-height: 1;
}

/* ---------------------------------------------------------------------- */
/* Step progress bar                                                      */
/* ---------------------------------------------------------------------- */

.afsw-steps {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	max-width: 420px;
	margin: 0 auto clamp(20px, 3vw, 28px);
	padding: 0 8px;
}

.afsw-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.afsw-step-dot {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-family: var(--afsw-font-mono);
	font-size: 12px;
	font-weight: 600;
	color: var(--afsw-text-faint);
	background: var(--afsw-surface);
	border: 1.5px solid var(--afsw-border);
	transition: all 0.3s var(--afsw-ease);
}

.afsw-step-label {
	font-size: 11px;
	font-weight: 500;
	color: var(--afsw-text-faint);
	letter-spacing: 0.02em;
	transition: color 0.3s var(--afsw-ease);
}

.afsw-step-line {
	flex: 1;
	height: 2px;
	min-width: 24px;
	margin: 0 6px 18px;
	background: var(--afsw-border);
	border-radius: 2px;
	position: relative;
	overflow: hidden;
}

.afsw-step-line::after {
	content: '';
	position: absolute;
	inset: 0;
	width: 0%;
	background: var(--afsw-accent-grad);
	transition: width 0.4s var(--afsw-ease);
}

.afsw-step-line.afsw-step-line-done::after {
	width: 100%;
}

.afsw-step.afsw-step-active .afsw-step-dot {
	border-color: var(--afsw-accent);
	color: var(--afsw-accent-2);
	background: rgba(124, 92, 252, 0.12);
	box-shadow: 0 0 0 4px rgba(124, 92, 252, 0.12);
}

.afsw-step.afsw-step-active .afsw-step-label {
	color: var(--afsw-text);
}

.afsw-step.afsw-step-done .afsw-step-dot {
	border-color: var(--afsw-success);
	color: #06231a;
	background: var(--afsw-success);
}

.afsw-step.afsw-step-done .afsw-step-label {
	color: var(--afsw-text-muted);
}

@media (max-width: 400px) {
	.afsw-step-label {
		display: none;
	}

	.afsw-steps {
		max-width: 220px;
	}
}

/* ---------------------------------------------------------------------- */
/* Footer brand mark                                                      */
/* ---------------------------------------------------------------------- */

.afsw-footer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: clamp(20px, 3vw, 28px) 0 0;
	font-family: var(--afsw-font-mono);
	font-size: 11px;
	letter-spacing: 0.04em;
	color: var(--afsw-text-faint);
	text-transform: uppercase;
}

.afsw-footer-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--afsw-accent-grad);
}

/* ---------------------------------------------------------------------- */
/* Grid / Cards                                                            */
/* ---------------------------------------------------------------------- */

.afsw-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
	gap: clamp(14px, 2.5vw, 24px);
	margin-bottom: clamp(20px, 3vw, 28px);
}

.afsw-card,
.afsw-result-card {
	position: relative;
	background: color-mix(in srgb, var(--afsw-surface) 72%, transparent);
	backdrop-filter: blur(18px) saturate(140%);
	-webkit-backdrop-filter: blur(18px) saturate(140%);
	border: 1px solid var(--afsw-border);
	border-radius: var(--afsw-radius);
	padding: clamp(16px, 2.2vw, 22px);
	transition: border-color 0.25s var(--afsw-ease), transform 0.25s var(--afsw-ease), box-shadow 0.25s var(--afsw-ease);
}

.afsw-card:hover,
.afsw-result-card:hover {
	border-color: rgba(124, 92, 252, 0.35);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.afsw-card-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: var(--afsw-font-display);
	font-weight: 600;
	font-size: 15px;
	margin-bottom: 6px;
}

.afsw-card-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	font-family: var(--afsw-font-mono);
	font-size: 10.5px;
	border-radius: 6px;
	background: rgba(124, 92, 252, 0.14);
	color: var(--afsw-accent);
	border: 1px solid rgba(124, 92, 252, 0.3);
}

.afsw-card-hint {
	margin: 0 0 14px;
	font-size: 13px;
	color: var(--afsw-text-faint);
}

/* ---------------------------------------------------------------------- */
/* Drop zone                                                               */
/* ---------------------------------------------------------------------- */

.afsw-drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	text-align: center;
	min-height: clamp(96px, 12vw, 128px);
	padding: 16px;
	border: 1.5px dashed rgba(255, 255, 255, 0.14);
	border-radius: var(--afsw-radius-sm);
	background: rgba(255, 255, 255, 0.015);
	cursor: pointer;
	color: var(--afsw-text-muted);
	transition: all 0.25s var(--afsw-ease);
}

.afsw-drop:hover,
.afsw-drop:focus-visible {
	border-color: var(--afsw-accent);
	background: rgba(124, 92, 252, 0.06);
	color: var(--afsw-text);
	outline: none;
}

.afsw-drop.afsw-dragover {
	border-color: var(--afsw-accent-2);
	background: rgba(34, 211, 238, 0.08);
	transform: scale(1.01);
}

.afsw-drop-icon {
	width: 26px;
	height: 26px;
	opacity: 0.7;
}

.afsw-drop-text {
	font-size: 13.5px;
	font-weight: 500;
}

.afsw-drop-hint {
	font-family: var(--afsw-font-mono);
	font-size: 10.5px;
	letter-spacing: 0.06em;
	color: var(--afsw-text-faint);
}

/* ---------------------------------------------------------------------- */
/* Preview                                                                 */
/* ---------------------------------------------------------------------- */

.afsw-preview {
	position: relative;
	margin-top: 14px;
	height: clamp(160px, 24vw, 220px);
	border-radius: var(--afsw-radius-sm);
	background:
		linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
		var(--afsw-surface-2);
	background-size: 18px 18px, 18px 18px, auto;
	border: 1px solid var(--afsw-border-soft);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 0.3s var(--afsw-ease), box-shadow 0.3s var(--afsw-ease);
}

.afsw-preview-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	color: var(--afsw-text-faint);
	font-size: 13px;
	padding: 0 16px;
	text-align: center;
}

.afsw-preview-icon {
	font-size: 26px;
	opacity: 0.5;
}

.afsw-preview-img {
	display: none;
	max-width: calc(100% - 24px);
	max-height: calc(100% - 24px);
	width: auto;
	height: auto;
	object-fit: contain;
	opacity: 0;
	transform: scale(0.96);
	transition: opacity 0.35s var(--afsw-ease), transform 0.35s var(--afsw-ease);
	pointer-events: none;
	border-radius: 10px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
	margin: auto;
}

.afsw-preview-img.afsw-visible {
	display: block;
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

.afsw-clear {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: none;
	background: rgba(11, 14, 20, 0.75);
	color: #fff;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	display: none;
	align-items: center;
	justify-content: center;
	transition: background 0.2s var(--afsw-ease), transform 0.2s var(--afsw-ease);
	backdrop-filter: blur(4px);
	z-index: 2;
}

.afsw-clear:focus-visible {
	outline: 2px solid var(--afsw-accent-2);
	outline-offset: 2px;
}

.afsw-clear:hover {
	background: var(--afsw-danger);
	transform: scale(1.08);
}

.afsw-clear.afsw-visible {
	display: flex;
}

/* ---------------------------------------------------------------------- */
/* Actions / run button                                                    */
/* ---------------------------------------------------------------------- */

.afsw-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-bottom: clamp(20px, 3vw, 28px);
}

.afsw-run-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 15px 40px;
	min-width: 220px;
	border: none;
	border-radius: 999px;
	background: var(--afsw-accent-grad);
	color: #fff;
	font-family: var(--afsw-font-display);
	font-weight: 600;
	font-size: 15px;
	letter-spacing: 0.01em;
	cursor: pointer;
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(124, 92, 252, 0.35);
	transition: transform 0.2s var(--afsw-ease), box-shadow 0.2s var(--afsw-ease), opacity 0.2s var(--afsw-ease);
}

.afsw-run-btn:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 14px 38px rgba(124, 92, 252, 0.45);
}

.afsw-run-btn:active:not(:disabled) {
	transform: translateY(0) scale(0.98);
}

.afsw-run-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.afsw-run-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
}

.afsw-run-icon {
	width: 17px;
	height: 17px;
	flex-shrink: 0;
}

.afsw-run-beam {
	position: absolute;
	inset: 0;
	background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
	transform: translateX(-120%);
	pointer-events: none;
}

.afsw-run-btn[data-loading="true"] .afsw-run-beam {
	animation: afsw-beam-sweep 1.4s linear infinite;
}

@keyframes afsw-beam-sweep {
	to { transform: translateX(120%); }
}

.afsw-status {
	margin: 0;
	min-height: 20px;
	font-family: var(--afsw-font-mono);
	font-size: 12.5px;
	letter-spacing: 0.01em;
	color: var(--afsw-text-muted);
	text-align: center;
	max-width: 60ch;
	margin-inline: auto;
	line-height: 1.5;
	word-break: break-word;
	padding: 0 8px;
}

.afsw-status[data-state="success"] { color: var(--afsw-success); }
.afsw-status[data-state="error"] { color: var(--afsw-danger); }

/* ---------------------------------------------------------------------- */
/* Result                                                                  */
/* ---------------------------------------------------------------------- */

.afsw-result-card {
	display: flex;
	flex-direction: column;
	background: linear-gradient(180deg, rgba(124, 92, 252, 0.05), transparent 40%), var(--afsw-surface);
	border-color: rgba(124, 92, 252, 0.18);
}

.afsw-preview-result {
	height: clamp(220px, 32vw, 320px);
	flex-direction: column;
	gap: 14px;
}

.afsw-preview-result.afsw-is-loading {
	border-color: rgba(124, 92, 252, 0.4);
	box-shadow: 0 0 0 1px rgba(124, 92, 252, 0.15), 0 0 32px rgba(124, 92, 252, 0.12) inset;
}

.afsw-preview-result.afsw-is-ready {
	border-color: rgba(46, 230, 166, 0.4);
	box-shadow: 0 0 0 1px rgba(46, 230, 166, 0.15), 0 0 32px rgba(46, 230, 166, 0.1) inset;
}

.afsw-spinner-label {
	display: none;
	font-family: var(--afsw-font-mono);
	font-size: 11.5px;
	letter-spacing: 0.06em;
	color: var(--afsw-accent-2);
	text-transform: uppercase;
}

.afsw-spinner-label.afsw-visible {
	display: block;
}

/* Spinner: three orbiting dots feels more "AI processing" than a plain ring */
.afsw-spinner {
	display: none;
	position: relative;
	width: 54px;
	height: 54px;
}

.afsw-spinner.afsw-visible {
	display: block;
}

.afsw-spinner span {
	position: absolute;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--afsw-accent-2);
	top: 50%;
	left: 50%;
	margin: -5px 0 0 -5px;
	animation: afsw-orbit 1.2s var(--afsw-ease) infinite;
}

.afsw-spinner span:nth-child(1) { background: var(--afsw-accent); animation-delay: 0s; }
.afsw-spinner span:nth-child(2) { background: var(--afsw-accent-2); animation-delay: 0.15s; }
.afsw-spinner span:nth-child(3) { background: #fff; animation-delay: 0.3s; }

@keyframes afsw-orbit {
	0%, 100% { transform: translate(0, -20px) scale(1); opacity: 1; }
	50% { transform: translate(0, 20px) scale(0.6); opacity: 0.5; }
}

.afsw-download {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 16px auto 0;
	padding: 12px 26px;
	border-radius: 999px;
	background: var(--afsw-accent-grad);
	border: 1px solid transparent;
	color: #fff;
	text-decoration: none;
	font-size: 13.5px;
	font-weight: 600;
	box-shadow: 0 8px 24px rgba(124, 92, 252, 0.3);
	transition: all 0.2s var(--afsw-ease);
}

.afsw-download:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 30px rgba(124, 92, 252, 0.4);
}

.afsw-download:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.afsw-download.afsw-visible {
	display: inline-flex;
	animation: afsw-fade-up 0.35s var(--afsw-ease);
}

@keyframes afsw-fade-up {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------- */
/* Reduced motion                                                          */
/* ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.afsw-root * {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* ---------------------------------------------------------------------- */
/* Responsive breakpoints                                                  */
/* ---------------------------------------------------------------------- */

@media (max-width: 640px) {
	.afsw-container {
		padding: 16px;
		border-radius: var(--afsw-radius);
	}

	.afsw-run-btn {
		width: 100%;
		min-width: 0;
	}

	.afsw-header {
		padding: 20px 8px 16px;
	}
}

@media (max-width: 400px) {
	.afsw-title {
		font-size: 22px;
	}

	.afsw-preview {
		height: 150px;
	}

	.afsw-preview-result {
		height: 190px;
	}
}

@media (min-width: 1200px) {
	.afsw-container {
		padding: 40px;
	}

	.afsw-title {
		font-size: 44px;
	}
}

/* ---------------------------------------------------------------------- */
/* Container-query overrides                                              */
/* These take priority (in supporting browsers) over the viewport media   */
/* queries above, so the widget adapts to the space it's actually given — */
/* e.g. a narrow sidebar on a wide desktop, or a wide embed on a phone —   */
/* not just the browser window size.                                      */
/* ---------------------------------------------------------------------- */

@container afswroot (max-width: 640px) {
	.afsw-container {
		padding: 16px;
		border-radius: var(--afsw-radius);
	}

	.afsw-run-btn {
		width: 100%;
		min-width: 0;
	}

	.afsw-header {
		padding: 20px 8px 16px;
	}
}

@container afswroot (min-width: 640.02px) {
	.afsw-container {
		padding: clamp(20px, 3vw, 32px);
		border-radius: var(--afsw-radius-lg);
	}

	.afsw-run-btn {
		width: auto;
		min-width: 220px;
	}
}

@container afswroot (max-width: 400px) {
	.afsw-title {
		font-size: 22px;
	}

	.afsw-preview {
		height: 150px;
	}

	.afsw-preview-result {
		height: 190px;
	}

	.afsw-eyebrow {
		font-size: 10px;
		padding: 5px 10px;
	}
}

@container afswroot (min-width: 1000px) {
	.afsw-container {
		padding: 40px;
	}

	.afsw-title {
		font-size: 44px;
	}
}
