.mft-app {
	--mft-app-bg: #181419;
	--mft-user-bg: #efe7dc;
	--mft-teller-bg: #28212a;
	--mft-user-text: #211a1d;
	--mft-teller-text: #fff7ec;
	--mft-general-text: #fff7ec;
	background: var(--mft-app-bg);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 8px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
	box-sizing: border-box;
	color: var(--mft-general-text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	margin: 24px auto;
	max-width: 780px;
	overflow: hidden;
	width: 100%;
}

.mft-app *,
.mft-app *::before,
.mft-app *::after {
	box-sizing: border-box;
}

.mft-shell {
	display: grid;
	min-height: 620px;
	grid-template-rows: auto 1fr;
}

.mft-topbar {
	align-items: center;
	border-bottom: 1px solid rgba(255, 255, 255, 0.14);
	display: flex;
	gap: 16px;
	justify-content: space-between;
	min-height: 72px;
	padding: 14px 18px;
}

.mft-brand {
	align-items: center;
	display: flex;
	font-size: 18px;
	font-weight: 750;
	gap: 12px;
	line-height: 1.2;
	min-width: 0;
}

.mft-brand span {
	overflow-wrap: anywhere;
}

.mft-rtl {
	direction: rtl;
	text-align: right;
}

.mft-logo {
	border-radius: 6px;
	display: block;
	height: 42px;
	object-fit: contain;
	width: 42px;
}

.mft-music-toggle,
.mft-primary-button,
.mft-category-button,
.mft-choice-button {
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	font: inherit;
	line-height: 1.2;
	transition: border-color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.mft-music-toggle {
	align-items: center;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.18);
	color: var(--mft-general-text);
	display: inline-flex;
	flex: 0 0 auto;
	font-size: 13px;
	gap: 8px;
	min-height: 38px;
	padding: 8px 12px;
}

.mft-music-toggle:disabled {
	cursor: not-allowed;
	opacity: 0.48;
}

.mft-audio-icon {
	border: 2px solid currentColor;
	border-radius: 50%;
	display: inline-block;
	height: 14px;
	position: relative;
	width: 14px;
}

.mft-audio-icon::after {
	background: currentColor;
	content: "";
	display: block;
	height: 2px;
	position: absolute;
	right: -7px;
	top: 4px;
	transform: rotate(-35deg);
	width: 8px;
}

.mft-music-toggle.is-muted .mft-audio-icon::after {
	left: -5px;
	right: auto;
	top: 5px;
	transform: rotate(45deg);
	width: 22px;
}

.mft-window {
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	min-height: 0;
}

.mft-messages {
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-height: 540px;
	min-height: 420px;
	overflow-y: auto;
	padding: 20px;
	scroll-behavior: smooth;
}

.mft-message-row {
	display: flex;
	width: 100%;
}

.mft-teller-row,
.mft-report-row {
	justify-content: flex-start;
}

.mft-user-row {
	justify-content: flex-end;
}

.mft-message {
	border-radius: 8px;
	font-size: 15px;
	line-height: 1.55;
	max-width: min(84%, 620px);
	overflow-wrap: anywhere;
	padding: 12px 14px;
	white-space: pre-wrap;
}

.mft-rtl .mft-message,
.mft-rtl .mft-category-button,
.mft-rtl .mft-choice-button,
.mft-rtl .mft-form input,
.mft-rtl .mft-answer-form input {
	text-align: right;
}

.mft-teller {
	background: var(--mft-teller-bg);
	border: 1px solid rgba(255, 255, 255, 0.12);
	color: var(--mft-teller-text);
}

.mft-user {
	background: var(--mft-user-bg);
	color: var(--mft-user-text);
}

.mft-report {
	background: #fff7ec;
	border: 1px solid rgba(72, 47, 26, 0.22);
	color: #211a1d;
	font-size: 16px;
	max-width: 100%;
}

.mft-controls {
	border-top: 1px solid rgba(255, 255, 255, 0.14);
	min-height: 92px;
	padding: 16px;
}

.mft-form {
	display: grid;
	gap: 10px;
	grid-template-columns: minmax(0, 1fr) minmax(0, 180px) auto;
}

.mft-form input {
	background: rgba(255, 255, 255, 0.94);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	color: #211a1d;
	font: inherit;
	min-height: 44px;
	min-width: 0;
	padding: 10px 12px;
	width: 100%;
}

.mft-primary-button {
	background: #d8b56d;
	color: #211a1d;
	font-weight: 750;
	min-height: 44px;
	padding: 10px 16px;
}

.mft-category-grid,
.mft-choice-list {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.mft-answer-form {
	display: grid;
	gap: 10px;
	grid-template-columns: minmax(0, 1fr) auto;
}

.mft-answer-form input {
	background: rgba(255, 255, 255, 0.94);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	color: #211a1d;
	font: inherit;
	min-height: 44px;
	min-width: 0;
	padding: 10px 12px;
	width: 100%;
}

.mft-category-button,
.mft-choice-button {
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.18);
	color: var(--mft-general-text);
	min-height: 48px;
	padding: 12px;
	text-align: left;
	width: 100%;
}

.mft-choice-button {
	min-height: 56px;
}

.mft-primary-button:hover,
.mft-category-button:hover,
.mft-choice-button:hover,
.mft-music-toggle:hover {
	opacity: 0.92;
	transform: translateY(-1px);
}

.mft-choice-panel {
	display: grid;
	gap: 12px;
}

.mft-progress {
	color: rgba(255, 255, 255, 0.72);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0;
}

.mft-typing {
	align-items: center;
	display: inline-flex;
	gap: 5px;
	min-height: 42px;
	min-width: 62px;
}

.mft-typing span {
	animation: mftTyping 900ms infinite ease-in-out;
	background: currentColor;
	border-radius: 50%;
	display: block;
	height: 7px;
	opacity: 0.42;
	width: 7px;
}

.mft-typing span:nth-child(2) {
	animation-delay: 130ms;
}

.mft-typing span:nth-child(3) {
	animation-delay: 260ms;
}

.mft-processing {
	align-items: center;
	display: inline-flex;
	gap: 10px;
}

.mft-reading-ring {
	animation: mftSpin 1100ms linear infinite;
	border: 2px solid rgba(255, 255, 255, 0.25);
	border-top-color: #d8b56d;
	border-radius: 50%;
	display: inline-block;
	height: 20px;
	width: 20px;
}

.mft-error-row .mft-message {
	border-color: rgba(255, 100, 100, 0.5);
}

@keyframes mftTyping {
	0%,
	80%,
	100% {
		opacity: 0.32;
		transform: translateY(0);
	}

	40% {
		opacity: 0.9;
		transform: translateY(-3px);
	}
}

@keyframes mftSpin {
	to {
		transform: rotate(360deg);
	}
}

@media (max-width: 680px) {
	.mft-shell {
		min-height: 560px;
	}

	.mft-topbar {
		align-items: flex-start;
		flex-direction: column;
	}

	.mft-music-toggle {
		width: 100%;
	}

	.mft-messages {
		max-height: 480px;
		min-height: 360px;
		padding: 14px;
	}

	.mft-message {
		max-width: 94%;
	}

	.mft-controls {
		padding: 14px;
	}

	.mft-form {
		grid-template-columns: 1fr;
	}

	.mft-answer-form {
		grid-template-columns: 1fr;
	}
}
