.replacement-widget {
	width: min(100%, 420px);
	margin-left: auto;
	display: flex;
	flex-direction: column;
}

.replacement-widget__card {
	background: #fff;
	border-radius: 16px;
	border: 1px solid #dbeafe;
	box-shadow: 0 12px 48px rgba(30, 64, 175, 0.12);
	height: 520px;
	position: relative;
	overflow: hidden;
}

.replacement-widget__top-bar {
	height: 4px;
	background: #1d4ed8;
}

.replacement-widget__badge {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 10;
	background: #1d4ed8;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 999px;
}

.replacement-widget__panel {
	position: absolute;
	inset: 0;
	padding: 12px 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.38s ease;
}

.replacement-widget__panel.active {
	opacity: 1;
	pointer-events: auto;
}

.replacement-widget__panel-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.replacement-widget__panel-body--center {
	align-items: center;
	justify-content: center;
}

.replacement-widget__dots {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	gap: 16px;
	margin-top: 16px;
}

.replacement-widget__dot-item,
.replacement-widget__dot-item:hover,
.replacement-widget__dot-item:focus,
.replacement-widget__dot-item:focus-visible,
.replacement-widget__dot-item:active {
	appearance: none;
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	box-shadow: none;
	outline: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	cursor: pointer;
}

.replacement-widget__dot {
	height: 6px;
	border-radius: 999px;
	background: #bfdbfe;
	transition: width 0.3s, background 0.3s;
	width: 6px;
}

.replacement-widget__dot.active {
	width: 28px;
	background: #1d4ed8;
}

.replacement-widget__dot-label {
	font-size: 9px;
	font-weight: 600;
	color: #bfdbfe;
	transition: color 0.3s;
}

.replacement-widget__dot-label.active {
	color: #1d4ed8;
}

.replacement-widget__field-stack {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 12px;
	justify-content: center;
}

.replacement-widget__field-row {
	display: flex;
	align-items: center;
	gap: 12px;
	animation: replacementWidgetSlideLeft 0.4s ease both;
}

.replacement-widget__field-row:nth-child(1) { animation-delay: 0.2s; }
.replacement-widget__field-row:nth-child(2) { animation-delay: 0.35s; }
.replacement-widget__field-row:nth-child(3) { animation-delay: 0.5s; }
.replacement-widget__field-row:nth-child(4) { animation-delay: 0.65s; }

.replacement-widget__field-label {
	height: 4px;
	width: 25%;
	background: #bfdbfe;
	border-radius: 999px;
	animation: replacementWidgetGrowX 0.3s ease both;
}

.replacement-widget__field-row:nth-child(1) .replacement-widget__field-label { animation-delay: 0.3s; }
.replacement-widget__field-row:nth-child(2) .replacement-widget__field-label { animation-delay: 0.45s; }
.replacement-widget__field-row:nth-child(3) .replacement-widget__field-label { animation-delay: 0.6s; }
.replacement-widget__field-row:nth-child(4) .replacement-widget__field-label { animation-delay: 0.75s; }

.replacement-widget__field-input {
	flex: 1;
	height: 36px;
	border-radius: 8px;
	background: #f8fafc;
	border: 1.5px solid #e2e8f0;
	position: relative;
	overflow: hidden;
	animation: replacementWidgetGrowX 0.4s ease both;
}

.replacement-widget__field-row:nth-child(1) .replacement-widget__field-input { animation-delay: 0.35s; }
.replacement-widget__field-row:nth-child(2) .replacement-widget__field-input { animation-delay: 0.5s; }
.replacement-widget__field-row:nth-child(3) .replacement-widget__field-input { animation-delay: 0.65s; }
.replacement-widget__field-row:nth-child(4) .replacement-widget__field-input { animation-delay: 0.8s; }

.replacement-widget__field-fill {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	background: #dbeafe;
	border-radius: 8px;
	animation: replacementWidgetFillBar 0.6s ease both;
	width: 0;
}

.replacement-widget__cert-preview {
	width: 85%;
	height: 80%;
	background: #fff;
	border: 2px solid #bfdbfe;
	border-radius: 12px;
	position: relative;
	animation: replacementWidgetFlip3d 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.replacement-widget__cert-inner {
	position: absolute;
	inset: 12px;
	border: 2px double #93c5fd;
	border-radius: 6px;
}

.replacement-widget__cert-seal {
	position: absolute;
	top: 16px;
	left: 16px;
	width: 40px;
	height: 40px;
	border: 1.5px solid #1d4ed8;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: replacementWidgetSpinIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both;
}

.replacement-widget__cert-seal-inner {
	width: 24px;
	height: 24px;
	background: #dbeafe;
	border-radius: 50%;
}

.replacement-widget__cert-title {
	position: absolute;
	top: 33%;
	left: 0;
	right: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.replacement-widget__title-bar {
	height: 4px;
	border-radius: 999px;
	background: #1d4ed8;
	animation: replacementWidgetGrowX 0.4s ease 0.8s both;
}

.replacement-widget__subtitle-bar {
	height: 2px;
	border-radius: 999px;
	background: #60a5fa;
	animation: replacementWidgetGrowX 0.4s ease 1s both;
}

.replacement-widget__cert-content {
	position: absolute;
	bottom: 32px;
	left: 0;
	right: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.replacement-widget__content-line {
	height: 2px;
	border-radius: 999px;
	background: #bfdbfe;
	animation: replacementWidgetGrowX 0.3s ease both;
}

.replacement-widget__cert-sig {
	position: absolute;
	bottom: 16px;
	right: 24px;
	width: 25%;
	height: 2px;
	background: #93c5fd;
	border-radius: 999px;
	animation: replacementWidgetGrowX 0.3s ease 1.5s both;
}

.replacement-widget__cert-check {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #dcfce7;
	border: 1.5px solid #86efac;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: replacementWidgetSpinIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 1.7s both;
}

.replacement-widget__flow-container {
	display: flex;
	align-items: center;
	gap: 12px;
}

.replacement-widget__flow-box {
	width: 80px;
	height: 80px;
	border-radius: 12px;
	background: #eff6ff;
	border: 2px solid #bfdbfe;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: replacementWidgetPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.replacement-widget__flow-box:nth-child(1) { animation-delay: 0.2s; }
.replacement-widget__flow-box:nth-child(3) { animation-delay: 0.5s; }
.replacement-widget__flow-box:nth-child(5) { animation-delay: 0.8s; }

.replacement-widget__flow-arrow {
	animation: replacementWidgetFadeIn 0.3s ease both;
}

.replacement-widget__flow-arrow:nth-child(2) { animation-delay: 0.5s; }
.replacement-widget__flow-arrow:nth-child(4) { animation-delay: 0.8s; }

.replacement-widget__printer {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.replacement-widget__printer-top {
	width: 48px;
	height: 10px;
	background: #1d4ed8;
	border-radius: 4px;
}

.replacement-widget__printer-body {
	width: 48px;
	height: 28px;
	background: #60a5fa;
	border: 2px solid #1d4ed8;
	border-radius: 8px;
	margin-top: 4px;
}

.replacement-widget__printer-sheet {
	width: 40px;
	height: 4px;
	background: #93c5fd;
	border-radius: 999px;
	margin-top: 4px;
	animation: replacementWidgetPrintMove 0.6s ease 0.8s infinite;
}

.replacement-widget__doc {
	width: 44px;
	height: 56px;
	background: #fff;
	border: 2px solid #1d4ed8;
	border-radius: 8px;
	position: relative;
	animation: replacementWidgetDocFlip 1s ease 1s infinite;
}

.replacement-widget__doc-lines {
	position: absolute;
	top: 8px;
	left: 8px;
	right: 8px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.replacement-widget__doc-line {
	height: 2px;
	background: #93c5fd;
	border-radius: 999px;
}

.replacement-widget__box {
	width: 48px;
	height: 48px;
	background: #1d4ed8;
	border-radius: 8px;
	position: relative;
	animation: replacementWidgetBoxBounce 1.5s ease 1.5s infinite;
}

.replacement-widget__box-top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 14px;
	background: #60a5fa;
	border-radius: 8px 8px 0 0;
}

.replacement-widget__box-tape {
	position: absolute;
	top: 0;
	left: 50%;
	width: 2px;
	height: 14px;
	background: #1d4ed8;
	transform: translateX(-50%);
}

@keyframes replacementWidgetFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes replacementWidgetSlideLeft { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes replacementWidgetPopIn { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes replacementWidgetSpinIn { from { transform: scale(0) rotate(-180deg); } to { transform: scale(1) rotate(0); } }
@keyframes replacementWidgetGrowX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes replacementWidgetFillBar { to { width: var(--w); } }
@keyframes replacementWidgetFlip3d { from { opacity: 0; transform: scale(0.8) rotateY(-90deg); } to { opacity: 1; transform: scale(1) rotateY(0); } }
@keyframes replacementWidgetPrintMove { 0%, 100% { transform: scaleX(0); } 50% { transform: scaleX(1); } }
@keyframes replacementWidgetDocFlip { 0%, 100% { transform: rotateY(0); } 50% { transform: rotateY(10deg); } }
@keyframes replacementWidgetBoxBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }

@media (max-width: 921px) {
	.replacement-widget {
		width: min(100%, 380px);
		margin: 0 auto;
	}

	.replacement-widget__card {
		height: 470px;
	}
}

@media (max-width: 640px) {
	.replacement-widget {
		width: 100%;
		max-width: 360px;
	}

	.replacement-widget__card {
		height: 450px;
	}

	.replacement-widget__flow-container {
		gap: 8px;
	}

	.replacement-widget__flow-box {
		width: 68px;
		height: 68px;
	}

	.replacement-widget__dots {
		gap: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.replacement-widget__field-row,
	.replacement-widget__field-label,
	.replacement-widget__field-input,
	.replacement-widget__field-fill,
	.replacement-widget__cert-preview,
	.replacement-widget__cert-seal,
	.replacement-widget__title-bar,
	.replacement-widget__subtitle-bar,
	.replacement-widget__content-line,
	.replacement-widget__cert-sig,
	.replacement-widget__cert-check,
	.replacement-widget__flow-box,
	.replacement-widget__flow-arrow,
	.replacement-widget__printer-sheet,
	.replacement-widget__doc,
	.replacement-widget__box {
		animation: none !important;
	}
}
