/*
 * Music Assistant — رابط گفتگو (طراحی مجدد v1.0.6)
 * - همه کلاس‌ها با پیشوند ma- هستند و ساختار HTML/JS قبلی دست‌نخورده می‌ماند.
 * - ریسپانسیو: دسکتاپ/تبلت = پنجره شناور، موبایل = تمام‌صفحه با پشتیبانی از کیبورد و safe-area.
 * - سازگار با حالت روشن، تاریک و خودکار.
 */

/* =========================================================
   ۱) متغیرها و پایه
   ========================================================= */
.ma-root {
	--ma-fg: #1b2030;
	--ma-muted: #6b7385;
	--ma-line: #e6e8f0;
	--ma-card: #f5f6fa;
	--ma-card-2: #eceef6;
	--ma-bot: #f3f4f9;
	--ma-user: var(--ma-c, #6c5ce7);
	--ma-user-fg: #fff;
	--ma-c2: var(--ma-c, #6c5ce7);
	--ma-ring: rgba(108, 92, 231, .22);
	--ma-tint: rgba(108, 92, 231, .08);
	--ma-danger: #d64545;
	--ma-r-lg: 22px;
	--ma-r-md: 16px;
	--ma-r-sm: 12px;
	--ma-shadow:
		0 28px 70px -18px rgba(18, 14, 48, .38),
		0 10px 24px -10px rgba(18, 14, 48, .22);
	--ma-vh: 100dvh;

	position: fixed;
	/* بالاتر از هدر ثابت و منوی موبایل قالب‌ها (مثلاً z-index: 99999 تا 100002) */
	z-index: 2147483000;
	direction: rtl;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.75;
	color: var(--ma-fg);
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
@supports (color: color-mix(in srgb, red, blue)) {
	.ma-root {
		--ma-c2: color-mix(in srgb, var(--ma-c, #6c5ce7) 58%, #ff4fa3);
		--ma-ring: color-mix(in srgb, var(--ma-c, #6c5ce7) 26%, transparent);
		--ma-tint: color-mix(in srgb, var(--ma-c, #6c5ce7) 9%, transparent);
	}
}
.ma-root *,
.ma-root *::before,
.ma-root *::after { box-sizing: border-box; }
.ma-root[hidden],
.ma-root [hidden] { display: none !important; }
.ma-root button { font-family: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ma-root img { max-width: 100%; }

.ma-theme-dark {
	--ma-fg: #e9ebf3;
	--ma-muted: #99a2b5;
	--ma-line: #2a2f3f;
	--ma-card: #222635;
	--ma-card-2: #2a2f40;
	--ma-bot: #232737;
	--ma-bg: #151821 !important;
	--ma-danger: #ff7b7b;
	--ma-shadow:
		0 28px 70px -18px rgba(0, 0, 0, .75),
		0 10px 24px -10px rgba(0, 0, 0, .55);
}
@media (prefers-color-scheme: dark) {
	.ma-theme-auto {
		--ma-fg: #e9ebf3;
		--ma-muted: #99a2b5;
		--ma-line: #2a2f3f;
		--ma-card: #222635;
		--ma-card-2: #2a2f40;
		--ma-bot: #232737;
		--ma-bg: #151821 !important;
		--ma-danger: #ff7b7b;
		--ma-shadow:
			0 28px 70px -18px rgba(0, 0, 0, .75),
			0 10px 24px -10px rgba(0, 0, 0, .55);
	}
}

.ma-i { width: 1.2em; height: 1.2em; flex: none; display: inline-block; vertical-align: middle; }

/* انیمیشن‌ها */
@keyframes ma-pop   { from { opacity: 0; transform: translateY(10px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes ma-win   { from { opacity: 0; transform: translateY(20px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes ma-sheet { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes ma-msg   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ma-pulse { 0% { box-shadow: 0 0 0 0 var(--ma-ring); } 70% { box-shadow: 0 0 0 18px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes ma-blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes ma-eq    { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* حالت‌های فوکوس (دسترس‌پذیری) */
.ma-fab:focus-visible,
.ma-btn:focus-visible,
.ma-icon-btn:focus-visible,
.ma-head-btn:focus-visible,
.ma-card-sugg:focus-visible,
.ma-chip:focus-visible,
.ma-send:focus-visible,
.ma-hist-item:focus-visible {
	outline: 2px solid var(--ma-c, #6c5ce7);
	outline-offset: 2px;
}

/* =========================================================
   ۲) دکمه شناور (FAB)
   ========================================================= */
.ma-fab {
	position: fixed;
	display: flex;
	align-items: center;
	gap: 10px;
	height: 56px;
	padding: 0 22px 0 20px;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	color: #fff;
	font: inherit;
	font-weight: 700;
	font-size: 14px;
	background: linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2));
	box-shadow:
		0 16px 32px -10px rgba(18, 14, 48, .5),
		0 4px 10px -4px rgba(18, 14, 48, .3),
		inset 0 1px 0 rgba(255, 255, 255, .3);
	animation: ma-pop .5s cubic-bezier(.2, .9, .3, 1.2) both, ma-pulse 2.6s 1s 3;
	transition: transform .2s, filter .2s, box-shadow .2s;
}
.ma-fab .ma-i { width: 26px; height: 26px; }
.ma-fab:hover { transform: translateY(-3px); filter: brightness(1.06); }
.ma-fab:active { transform: scale(.96); }

.ma-pos-bottom_right .ma-fab { bottom: calc(var(--ma-ob) + env(safe-area-inset-bottom, 0px)); right: calc(var(--ma-os) + env(safe-area-inset-right, 0px)); }
.ma-pos-bottom_left  .ma-fab { bottom: calc(var(--ma-ob) + env(safe-area-inset-bottom, 0px)); left:  calc(var(--ma-os) + env(safe-area-inset-left, 0px)); }
.ma-pos-side_right .ma-fab { top: 50%; right: 0; height: 52px; transform: translateY(-50%); border-radius: 18px 0 0 18px; animation: none; }
.ma-pos-side_left  .ma-fab { top: 50%; left: 0;  height: 52px; transform: translateY(-50%); border-radius: 0 18px 18px 0; animation: none; }
.ma-pos-side_right .ma-fab:hover,
.ma-pos-side_left  .ma-fab:hover { transform: translateY(-50%); filter: brightness(1.08); }
.ma-root.ma-open .ma-fab { display: none; }

/* =========================================================
   ۳) پنجره اصلی
   ========================================================= */
.ma-window {
	position: fixed;
	display: flex;
	flex-direction: column;
	width: min(var(--ma-w), calc(100vw - 2 * var(--ma-os)));
	height: min(var(--ma-h), calc(100vh - var(--ma-ob) - 16px));
	height: min(var(--ma-h), calc(100dvh - var(--ma-ob) - 16px));
	background: var(--ma-bg, #fff);
	border-radius: 26px;
	box-shadow: var(--ma-shadow), 0 0 0 1px var(--ma-line);
	overflow: hidden;
	transform-origin: bottom right;
	animation: ma-win .34s cubic-bezier(.2, .9, .3, 1.08) both;
	container-type: inline-size;
	container-name: ma;
}
.ma-pos-bottom_left .ma-window,
.ma-pos-side_left .ma-window { transform-origin: bottom left; }
.ma-pos-bottom_right .ma-window,
.ma-pos-side_right .ma-window { right: var(--ma-os); bottom: var(--ma-ob); }
.ma-pos-bottom_left .ma-window,
.ma-pos-side_left .ma-window { left: var(--ma-os); bottom: var(--ma-ob); }
.ma-pos-side_right .ma-window,
.ma-pos-side_left .ma-window {
	bottom: 16px;
	height: min(var(--ma-h), calc(100vh - 32px));
	height: min(var(--ma-h), calc(100dvh - 32px));
}

/* =========================================================
   ۴) سربرگ
   ========================================================= */
.ma-header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 16px 14px 22px 14px;
	color: #fff;
	flex: none;
	overflow: hidden;
	background:
		radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .22), transparent 55%),
		linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2));
}
.ma-header::before,
.ma-header::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
	background: rgba(255, 255, 255, .1);
}
.ma-header::before { width: 170px; height: 170px; left: -60px; top: -100px; }
.ma-header::after  { width: 110px; height: 110px; right: 28%; bottom: -74px; background: rgba(255, 255, 255, .07); }

.ma-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.ma-brand-icon {
	position: relative;
	display: grid;
	place-items: center;
	flex: none;
	width: 46px;
	height: 46px;
	border-radius: 15px;
	background: rgba(255, 255, 255, .2);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), 0 8px 18px -8px rgba(0, 0, 0, .35);
}
.ma-brand-icon .ma-i { width: 27px; height: 27px; }
.ma-brand-text { min-width: 0; }
.ma-brand-title {
	font-weight: 800;
	font-size: 16px;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ma-brand-sub {
	font-size: 11.5px;
	line-height: 1.45;
	opacity: .88;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ma-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 3px;
	padding: 1px 9px;
	border-radius: 999px;
	font-size: 11px;
	line-height: 1.7;
	background: rgba(0, 0, 0, .17);
}
.ma-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .3); }

.ma-header-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; flex: none; }
.ma-head-btn {
	display: inline-grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	cursor: pointer;
	color: #fff;
	font-size: 12px;
	background: rgba(255, 255, 255, .17);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
	transition: background .15s, transform .15s;
}
.ma-head-btn span { display: none; }
.ma-head-btn:hover { background: rgba(255, 255, 255, .32); transform: translateY(-1px); }
.ma-head-btn:active { transform: scale(.94); }
.ma-head-btn .ma-i { width: 18px; height: 18px; }

/* =========================================================
   ۵) بدنه و پیام‌ها
   ========================================================= */
.ma-body {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	margin-top: -14px;
	border-radius: 22px 22px 0 0;
	background: var(--ma-bg, #fff);
}
.ma-messages {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 18px 14px 10px;
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: rgba(127, 127, 127, .35) transparent;
	background:
		radial-gradient(90% 60% at 50% 0%, var(--ma-tint), transparent 70%),
		var(--ma-bg, #fff);
}
.ma-messages::-webkit-scrollbar { width: 6px; }
.ma-messages::-webkit-scrollbar-thumb { background: rgba(127, 127, 127, .35); border-radius: 6px; }
.ma-messages::-webkit-scrollbar-track { background: transparent; }

/* خوش‌آمدگویی */
.ma-welcome { animation: ma-msg .45s ease both; }
.ma-welcome-text {
	position: relative;
	margin-bottom: 14px;
	padding: 22px 18px 18px;
	text-align: center;
	line-height: 1.95;
	border: 1px solid var(--ma-line);
	border-radius: var(--ma-r-lg);
	background:
		linear-gradient(180deg, var(--ma-tint), transparent 60%),
		var(--ma-bot);
	box-shadow: 0 10px 28px -20px rgba(18, 14, 48, .5);
}
.ma-welcome-hero {
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	margin: 0 auto 12px;
	border-radius: 20px;
	color: #fff;
	background: linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2));
	box-shadow: 0 14px 26px -10px var(--ma-c, #6c5ce7), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.ma-welcome-hero .ma-i { width: 32px; height: 32px; }

.ma-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ma-card-sugg,
.ma-chip {
	position: relative;
	padding: 11px 13px;
	border: 1px solid var(--ma-line);
	border-radius: var(--ma-r-md);
	cursor: pointer;
	color: var(--ma-fg);
	background: var(--ma-card);
	font: inherit;
	font-size: 13px;
	line-height: 1.6;
	text-align: right;
	transition: transform .15s, border-color .15s, box-shadow .15s, background .15s;
}
.ma-card-sugg::before {
	content: "♪";
	display: block;
	margin-bottom: 2px;
	color: var(--ma-c, #6c5ce7);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
}
.ma-card-sugg:hover,
.ma-chip:hover {
	transform: translateY(-2px);
	border-color: var(--ma-c, #6c5ce7);
	background: var(--ma-bg, #fff);
	box-shadow: 0 10px 22px -12px var(--ma-c, #6c5ce7);
}
.ma-card-sugg:active,
.ma-chip:active { transform: scale(.98); }

/* حباب‌های پیام */
.ma-msg { display: flex; max-width: 100%; animation: ma-msg .28s ease both; }
.ma-msg-user { justify-content: flex-start; }
.ma-msg-bot { flex-direction: row-reverse; justify-content: flex-start; align-items: flex-end; gap: 8px; }
.ma-msg-bot::before {
	content: "";
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 3v10.6A4 4 0 1014 17V7h4V3h-6z'/%3E%3C/svg%3E") center / 58% no-repeat,
		linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2));
	box-shadow: 0 6px 12px -6px var(--ma-c, #6c5ce7);
}
.ma-bubble {
	max-width: 100%;
	padding: 10px 15px;
	border-radius: 20px;
	background: var(--ma-bot);
	overflow-wrap: anywhere;
	word-wrap: break-word;
	box-shadow: 0 1px 2px rgba(18, 14, 48, .06);
}
.ma-msg-user .ma-bubble {
	max-width: 86%;
	border-bottom-right-radius: 7px;
	color: var(--ma-user-fg);
	white-space: pre-wrap;
	background: linear-gradient(135deg, var(--ma-user), var(--ma-c2));
	box-shadow: 0 12px 22px -12px var(--ma-c, #6c5ce7);
}
.ma-msg-bot .ma-bubble {
	flex: 0 1 auto;
	max-width: calc(100% - 40px);
	border: 1px solid var(--ma-line);
	border-bottom-left-radius: 7px;
}
.ma-msg-bot .ma-bubble:has(.ma-song, .ma-playlist, .ma-artist) { flex: 1 1 auto; min-width: 0; }
.ma-msg-bot:has(.ma-song, .ma-playlist, .ma-artist) { align-items: flex-start; }
.ma-text { overflow-wrap: anywhere; }

.ma-msg-err .ma-bubble { color: #8a1f1f; background: #fdecec; border-color: #f6c9c9; }
.ma-theme-dark .ma-msg-err .ma-bubble { color: #ffb4b4; background: #3a2024; border-color: #5b2f35; }
@media (prefers-color-scheme: dark) {
	.ma-theme-auto .ma-msg-err .ma-bubble { color: #ffb4b4; background: #3a2024; border-color: #5b2f35; }
}
.ma-msg-err::before { background: #e5484d; }

.ma-typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.ma-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ma-c, #6c5ce7); animation: ma-blink 1.2s infinite both; }
.ma-typing span:nth-child(2) { animation-delay: .18s; }
.ma-typing span:nth-child(3) { animation-delay: .36s; }

/* =========================================================
   ۶) کارت آهنگ
   ========================================================= */
.ma-song {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 12px;
	row-gap: 0;
	align-items: start;
	margin-top: 10px;
	padding: 11px;
	border: 1px solid var(--ma-line);
	border-radius: var(--ma-r-md);
	background: var(--ma-bg, #fff);
	box-shadow: 0 8px 20px -16px rgba(18, 14, 48, .55);
	transition: border-color .2s, box-shadow .2s, transform .2s;
}
.ma-song:first-child { margin-top: 2px; }
.ma-song:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -16px rgba(18, 14, 48, .55); }
.ma-song.ma-playing {
	border-color: var(--ma-c, #6c5ce7);
	background: linear-gradient(180deg, var(--ma-tint), transparent), var(--ma-bg, #fff);
	box-shadow: 0 0 0 3px var(--ma-ring), 0 14px 28px -16px var(--ma-c, #6c5ce7);
}
.ma-song.ma-playing .ma-song-title::after {
	content: "";
	display: inline-block;
	width: 14px;
	height: 12px;
	margin-right: 8px;
	vertical-align: middle;
	transform-origin: bottom;
	animation: ma-eq .9s ease-in-out infinite;
	background:
		linear-gradient(var(--ma-c, #6c5ce7), var(--ma-c, #6c5ce7)) 0 100% / 3px 100% no-repeat,
		linear-gradient(var(--ma-c, #6c5ce7), var(--ma-c, #6c5ce7)) 50% 100% / 3px 100% no-repeat,
		linear-gradient(var(--ma-c, #6c5ce7), var(--ma-c, #6c5ce7)) 100% 100% / 3px 100% no-repeat;
}
.ma-cover {
	flex: none;
	width: 66px;
	height: 66px;
	border-radius: 14px;
	object-fit: cover;
	background: var(--ma-card);
	box-shadow: 0 10px 18px -10px rgba(0, 0, 0, .55);
}
.ma-row .ma-cover { width: 50px; height: 50px; border-radius: 12px; }
/* بدنه «شفاف» می‌شود تا عنوان کنار کاور بنشیند و دکمه‌ها تمام عرض کارت را بگیرند */
.ma-song-body { display: contents; }
.ma-song .ma-cover { grid-column: 1; grid-row: 1 / span 3; align-self: start; }
.ma-song .ma-song-title,
.ma-song .ma-song-artist,
.ma-song .ma-love,
.ma-song .ma-snippet { grid-column: 2; min-width: 0; }
.ma-song .ma-actions,
.ma-song .ma-lyrics { grid-column: 1 / -1; }
.ma-song-title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	line-height: 1.6;
}
.ma-song-title a { color: var(--ma-fg); font-weight: 800; text-decoration: none; }
.ma-song-title a:hover { color: var(--ma-c, #6c5ce7); }
.ma-song-artist { color: var(--ma-muted); font-size: 12.5px; line-height: 1.6; }
.ma-love { justify-self: start; margin-top: 2px; padding: 1px 9px; border-radius: 999px; background: rgba(255, 79, 163, .12); color: #c2255c; font-size: 11.5px; font-weight: 700; line-height: 1.7; cursor: default; }
.ma-theme-dark .ma-love { background: rgba(255, 79, 163, .18); color: #ff9cc8; }
.ma-snippet { margin-top: 2px; color: var(--ma-muted); font-size: 12px; }

.ma-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ma-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	padding: 3px 12px;
	border: 1px solid var(--ma-line);
	border-radius: 999px;
	cursor: pointer;
	color: var(--ma-fg);
	background: var(--ma-card);
	font: inherit;
	font-size: 12px;
	line-height: 1.9;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color .15s, transform .15s, filter .15s, background .15s;
}
.ma-btn .ma-i { width: 14px; height: 14px; }
.ma-btn:hover { border-color: var(--ma-c, #6c5ce7); transform: translateY(-1px); }
.ma-btn:active { transform: scale(.96); }
.ma-btn:disabled { opacity: .55; cursor: wait; }
.ma-btn-primary {
	color: #fff;
	border-color: transparent;
	background: linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2));
	box-shadow: 0 8px 16px -10px var(--ma-c, #6c5ce7);
}
.ma-btn-primary:hover { border-color: transparent; filter: brightness(1.08); }
.ma-btn-danger { color: var(--ma-danger); }

.ma-lyrics { margin-top: 9px; font-size: 12.5px; }
.ma-lyrics summary { cursor: pointer; color: var(--ma-c, #6c5ce7); font-weight: 700; }
.ma-lyrics-text {
	max-height: 180px;
	margin-top: 6px;
	padding: 10px 12px;
	overflow: auto;
	border-radius: var(--ma-r-sm);
	background: var(--ma-card);
	line-height: 2;
	white-space: normal;
	font-size: 13px;
}

/* =========================================================
   ۷) پلی‌لیست و خواننده
   ========================================================= */
.ma-playlist { margin-top: 4px; }
.ma-pl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 2px; }
.ma-pl-head strong { font-size: 14.5px; line-height: 1.6; }
.ma-pl-n {
	flex: none;
	padding: 1px 10px;
	border-radius: 999px;
	color: var(--ma-c, #6c5ce7);
	background: var(--ma-ring);
	font-size: 11.5px;
	font-weight: 700;
}
.ma-pl-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ma-pl-list { counter-reset: ma-n; }
.ma-pl-list .ma-song { counter-increment: ma-n; }
.ma-pl-list .ma-song::after {
	content: counter(ma-n, persian);
	position: absolute;
	top: 16px;
	right: 16px;
	display: grid;
	place-items: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 8px 4px 8px 4px;
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	line-height: 1;
	background: rgba(18, 14, 48, .72);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	pointer-events: none;
}

.ma-artist {
	display: flex;
	gap: 14px;
	margin-top: 8px;
	padding: 14px;
	border: 1px solid var(--ma-line);
	border-radius: 20px;
	background: linear-gradient(160deg, var(--ma-tint), transparent 70%), var(--ma-card);
}
.ma-artist-img {
	flex: none;
	width: 70px;
	height: 70px;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: 0 0 0 3px var(--ma-bg, #fff), 0 0 0 5px var(--ma-c, #6c5ce7);
}
.ma-artist-body { flex: 1; min-width: 0; }
.ma-artist-name { font-size: 15px; font-weight: 800; line-height: 1.6; }
.ma-artist-bio {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	overflow: hidden;
	color: var(--ma-muted);
	font-size: 12.5px;
	line-height: 1.85;
}

/* =========================================================
   ۸) پنل‌های سابقه و راهنما
   ========================================================= */
.ma-panel {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 22px 22px 0 0;
	background: var(--ma-bg, #fff);
	animation: ma-sheet .26s cubic-bezier(.2, .9, .3, 1) both;
}
.ma-panel-head {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 15px 16px;
	border-bottom: 1px solid var(--ma-line);
	background: var(--ma-card);
}
.ma-panel-head strong { font-size: 14.5px; line-height: 1.6; }
.ma-hist-list { flex: 1; min-height: 0; padding: 12px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ma-hist-empty { padding: 44px 24px; text-align: center; color: var(--ma-muted); }
.ma-hist-item {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
	padding: 11px 13px;
	border: 1px solid var(--ma-line);
	border-radius: var(--ma-r-md);
	cursor: pointer;
	background: var(--ma-card);
	transition: border-color .15s, transform .15s, box-shadow .15s;
}
.ma-hist-item:hover { transform: translateY(-1px); border-color: var(--ma-c, #6c5ce7); box-shadow: 0 10px 20px -14px var(--ma-c, #6c5ce7); }
.ma-hist-main { flex: 1; min-width: 0; }
.ma-hist-title { overflow: hidden; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.ma-hist-snip { overflow: hidden; color: var(--ma-muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.ma-hist-date { color: var(--ma-muted); font-size: 11px; }
.ma-panel-foot { flex: none; padding: 11px 14px 13px; border-top: 1px solid var(--ma-line); background: var(--ma-card); }
.ma-private { display: block; margin-bottom: 9px; color: var(--ma-muted); font-size: 12px; }
.ma-private input { accent-color: var(--ma-c, #6c5ce7); margin-left: 4px; }
.ma-foot-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ma-help-list { flex: none; margin: 0; padding: 16px 34px 6px; line-height: 2; overflow-y: auto; }
.ma-help-list li::marker { color: var(--ma-c, #6c5ce7); }
.ma-help-sub { padding: 8px 16px; color: var(--ma-muted); font-size: 12px; }
.ma-chips { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 16px; overflow-y: auto; }
.ma-help-panel { overflow-y: auto; }

.ma-icon-btn {
	display: inline-grid;
	place-items: center;
	padding: 6px;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	color: inherit;
	background: transparent;
	transition: background .15s;
}
.ma-icon-btn:hover { background: rgba(127, 127, 127, .2); }

/* =========================================================
   ۹) پلیر کوچک
   ========================================================= */
.ma-player {
	position: relative;
	flex: none;
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 12px 8px;
	padding: 9px 10px 11px;
	overflow: hidden;
	border: 1px solid var(--ma-line);
	border-radius: 20px;
	background: linear-gradient(180deg, var(--ma-tint), transparent), var(--ma-card);
	box-shadow: 0 14px 28px -18px rgba(18, 14, 48, .6);
}
.ma-player-cover { flex: none; width: 40px; height: 40px; border-radius: 12px; object-fit: cover; }
.ma-player-info { flex: 1; min-width: 0; padding: 0 4px; }
.ma-player-title,
.ma-player-artist { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ma-player-title { font-size: 12.5px; font-weight: 800; line-height: 1.7; }
.ma-player-artist { color: var(--ma-muted); font-size: 11px; line-height: 1.5; }
.ma-player .ma-icon-btn { width: 32px; height: 32px; padding: 0; }
.ma-player .ma-icon-btn .ma-i { width: 18px; height: 18px; }
.ma-player .ma-player-toggle {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	color: #fff;
	background: linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2));
	box-shadow: 0 8px 16px -8px var(--ma-c, #6c5ce7);
}
.ma-player .ma-player-toggle:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2)); }
.ma-player-progress { direction: ltr; position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: rgba(127, 127, 127, .18); }
.ma-player-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--ma-c, #6c5ce7), var(--ma-c2)); transition: width .25s linear; }
.ma-player.ma-is-playing .ma-player-cover { box-shadow: 0 0 0 2px var(--ma-c, #6c5ce7); }

/* =========================================================
   ۱۰) فرم نوشتن پیام
   ========================================================= */
.ma-form {
	flex: none;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px 12px;
	background: var(--ma-bg, #fff);
	border-top: 1px solid var(--ma-line);
}
.ma-input {
	flex: 1;
	min-width: 0;
	min-height: 46px;
	max-height: 120px;
	padding: 11px 17px;
	border: 1.5px solid var(--ma-line);
	border-radius: 23px;
	outline: 0;
	resize: none;
	color: var(--ma-fg);
	background: var(--ma-card);
	font: inherit;
	line-height: 1.6;
	direction: rtl;
	transition: border-color .15s, box-shadow .15s, background .15s;
}
.ma-input::placeholder { color: var(--ma-muted); opacity: .9; }
.ma-input:focus { border-color: var(--ma-c, #6c5ce7); background: var(--ma-bg, #fff); box-shadow: 0 0 0 4px var(--ma-ring); }
.ma-send {
	flex: none;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	color: #fff;
	background: linear-gradient(135deg, var(--ma-c, #6c5ce7), var(--ma-c2));
	box-shadow: 0 12px 22px -10px var(--ma-c, #6c5ce7);
	transition: transform .15s, filter .15s;
}
.ma-send:hover:not(:disabled) { transform: scale(1.07); filter: brightness(1.07); }
.ma-send:active:not(:disabled) { transform: scale(.94); }
.ma-send .ma-i { width: 20px; height: 20px; transform: scaleX(-1); }
.ma-send:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.ma-toast {
	position: absolute;
	left: 50%;
	bottom: 80px;
	z-index: 9;
	max-width: 90%;
	padding: 9px 18px;
	border-radius: 999px;
	color: #fff;
	font-size: 12.5px;
	text-align: center;
	background: rgba(17, 17, 24, .92);
	box-shadow: 0 14px 28px -10px rgba(0, 0, 0, .55);
	transform: translateX(-50%);
	animation: ma-pop .2s ease both;
}

.ma-no-js-hide { display: none; }
@media (min-width: 769px) { .ma-no-desktop { display: none !important; } }
@media (max-width: 768px) { .ma-no-mobile { display: none !important; } }

/* =========================================================
   ۱۱) ریسپانسیو
   ========================================================= */

/* --- پنجره‌های باریک (بر اساس عرض خود پنجره) --- */
@container ma (max-width: 400px) {
	.ma-brand-sub { display: none; }
	.ma-status { white-space: nowrap; }
	.ma-head-btn { width: 36px; height: 36px; }
	.ma-header-actions { gap: 4px; }
	.ma-brand { gap: 10px; }
	.ma-header { padding-right: 12px; padding-left: 12px; }
	.ma-messages { padding-right: 12px; padding-left: 12px; }
	.ma-cover { width: 58px; height: 58px; }
}
@container ma (max-width: 340px) {
	.ma-head-btn { width: 32px; height: 32px; border-radius: 11px; }
	.ma-brand-title { font-size: 15px; }
	.ma-brand-icon { width: 38px; height: 38px; }
	.ma-status { display: none; }
	.ma-actions .ma-btn[data-ma-act="copy"] span,
	.ma-actions .ma-btn[data-ma-act="queue-add"] span { display: none; }
	.ma-actions .ma-btn[data-ma-act="copy"],
	.ma-actions .ma-btn[data-ma-act="queue-add"] { padding-right: 9px; padding-left: 9px; }
	.ma-artist { flex-direction: column; align-items: center; text-align: center; }
	.ma-artist .ma-actions { justify-content: center; }
}
@container ma (min-width: 520px) {
	.ma-messages { padding-right: 20px; padding-left: 20px; }
	.ma-cover { width: 74px; height: 74px; }
	.ma-row .ma-cover { width: 56px; height: 56px; }
	.ma-bubble { font-size: 14.5px; }
}

/* --- نمایشگرهای کوتاه (موبایل افقی، پنجره‌های کم‌ارتفاع) --- */
@media (max-height: 520px) {
	.ma-header { padding-top: 10px; padding-bottom: 18px; }
	.ma-brand-sub,
	.ma-status { display: none; }
	.ma-brand-icon { width: 38px; height: 38px; border-radius: 12px; }
	.ma-brand-icon .ma-i { width: 22px; height: 22px; }
	.ma-welcome-hero { display: none; }
	.ma-welcome-text { padding: 14px; }
	.ma-form { padding-top: 8px; padding-bottom: 8px; }
	.ma-input { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
	.ma-send { width: 40px; height: 40px; }
}

/* --- تبلت و دسکتاپ کوچک: پنجره شناور اما با فاصله امن --- */
@media (min-width: 769px) and (max-width: 1024px) {
	.ma-window { border-radius: 24px; }
}

/* --- موبایل (و گوشی در حالت افقی): تمام‌صفحه --- */
@media (max-width: 768px), (max-height: 520px) and (pointer: coarse) {
	.ma-fab { height: 58px; width: 58px; padding: 0; justify-content: center; }
	.ma-fab-label { display: none; }
	.ma-fab .ma-i { width: 28px; height: 28px; }
	.ma-pos-side_right .ma-fab,
	.ma-pos-side_left .ma-fab { width: 48px; height: 56px; }

	.ma-window {
		position: fixed !important;
		top: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		left: 0 !important;
		width: 100% !important;
		max-width: none !important;
		height: 100vh !important;
		height: var(--ma-vh, 100dvh) !important;
		max-height: none !important;
		border-radius: 0;
		box-shadow: none;
		transform-origin: bottom center;
		animation: ma-sheet .3s cubic-bezier(.2, .9, .3, 1) both;
	}
	.ma-header {
		padding: calc(14px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 20px calc(12px + env(safe-area-inset-left, 0px));
	}
	.ma-head-btn .ma-i { width: 19px; height: 19px; }
	.ma-body { border-radius: 20px 20px 0 0; }
	.ma-panel { border-radius: 20px 20px 0 0; }
	.ma-messages { padding: 16px 12px 8px; gap: 12px; }
	.ma-bubble { font-size: 14.5px; }
	.ma-msg-user .ma-bubble { max-width: 90%; }

	.ma-player { margin-right: 10px; margin-left: 10px; }
	.ma-form {
		gap: 8px;
		padding: 10px calc(10px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
	}
	/* جلوگیری از زوم خودکار iOS هنگام فوکوس */
	.ma-input { font-size: 16px; min-height: 48px; }
	.ma-send { width: 48px; height: 48px; }
	.ma-toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
	.ma-panel-foot { padding-bottom: calc(13px + env(safe-area-inset-bottom, 0px)); }
}

/* --- لمسی: هدف‌های لمسی راحت‌تر --- */
@media (pointer: coarse) {
	.ma-btn { min-height: 34px; padding-right: 13px; padding-left: 13px; }
	.ma-actions { gap: 7px; }
	.ma-player .ma-icon-btn { width: 36px; height: 36px; }
	.ma-icon-btn { min-width: 36px; min-height: 36px; }
	.ma-card-sugg,
	.ma-chip { min-height: 44px; }
}

/* وقتی پنجره روی موبایل باز است، اسکرول صفحه پشت آن قفل شود */
html.ma-lock,
html.ma-lock body { overflow: hidden !important; overscroll-behavior: none; }

@media (hover: none) {
	.ma-song:hover,
	.ma-hist-item:hover,
	.ma-card-sugg:hover,
	.ma-chip:hover,
	.ma-btn:hover,
	.ma-fab:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.ma-root *,
	.ma-root *::before,
	.ma-root *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
