/* Титулы: бейджи, попап, выбор в профиле */

.amd-titles {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	vertical-align: middle;
	max-width: 100%;
	line-height: 1;
}
.comment-item__meta .amd-titles,
.usp__name-row .amd-titles {
	margin: 0;
}
.amd-badge,
.amd-badge * {
	animation-play-state: running !important;
}
.amd-badge {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 22px;
	padding: 0 10px;
	border-radius: 9999px;
	user-select: none;
	isolation: isolate;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	box-sizing: border-box;
	border: 1px solid transparent;
	box-shadow: var(--amd-tt-badge-shadow, none);
	--fx-sp: 1;
	--fx-sz: 1;
	--fx-op: 1;
	--rank-sat: 1;
	--rank-br: 1;
	--rank-ct: 1;
	flex: 0 0 auto;
	vertical-align: middle;
}
.amd-badge--reviews {
	background: var(--amd-tt-reviews-bg, #eff6ff) !important;
	border-color: var(--amd-tt-reviews-border, rgba(96, 165, 250, .75)) !important;
	--amd-title-glow: var(--amd-tt-reviews-glow, rgba(56, 189, 248, .45));
	--amd-title-accent: var(--amd-tt-reviews-accent, #2563eb);
	--amd-title-accent2: var(--amd-tt-reviews-accent2, #4338ca);
}
.amd-badge--comments {
	background: var(--amd-tt-comments-bg, #f7f3ff) !important;
	border-color: var(--amd-tt-comments-border, rgba(124, 77, 255, .45)) !important;
	--amd-title-glow: var(--amd-tt-comments-glow, rgba(124, 77, 255, .35));
	--amd-title-accent: var(--amd-tt-comments-accent, #cc99ff);
	--amd-title-accent2: var(--amd-tt-comments-accent2, #d376fe);
}
.amd-badge--series {
	background: var(--amd-tt-series-bg, #fff5f7) !important;
	border-color: var(--amd-tt-series-border, rgba(220, 38, 38, .35)) !important;
	--amd-title-glow: var(--amd-tt-series-glow, rgba(220, 38, 38, .35));
	--amd-title-accent: var(--amd-tt-series-accent, #e11d48);
	--amd-title-accent2: var(--amd-tt-series-accent2, #7e22ce);
}
.amd-badge--blog {
	background: var(--amd-tt-blog-bg, #fff5f5) !important;
	border-color: var(--amd-tt-blog-border, rgba(220, 38, 38, .45)) !important;
	--amd-title-glow: var(--amd-tt-blog-glow, rgba(220, 38, 38, .35));
	--amd-title-accent: var(--amd-tt-blog-accent, #dc2626);
	--amd-title-accent2: var(--amd-tt-blog-accent, #dc2626);
}
.amd-badge--friends {
	background: var(--amd-tt-friends-bg, #fff8f0) !important;
	border-color: var(--amd-tt-friends-border, rgba(251, 146, 60, .45)) !important;
	--amd-title-glow: var(--amd-tt-friends-glow, rgba(251, 146, 60, .4));
	--amd-title-accent: var(--amd-tt-friends-accent, #ea580c);
	--amd-title-accent2: var(--amd-tt-friends-accent, #ea580c);
}
.amd-badge--lg {
	height: 36px;
	padding: 0 16px;
	gap: 8px;
}
.amd-badge--md,
.comment-item__meta .amd-badge,
.js-comm .amd-badge,
.profile-wall-comment .amd-badge,
.ac-comments .amd-badge {
	height: 24px;
	padding: 0 11px;
	gap: 7px;
}
.amd-badge--md .amd-ico,
.amd-badge--md .amd-ico svg,
.comment-item__meta .amd-badge .amd-ico,
.comment-item__meta .amd-badge .amd-ico svg,
.js-comm .amd-badge .amd-ico,
.js-comm .amd-badge .amd-ico svg {
	width: 16px;
	height: 16px;
}
.amd-badge--md .amd-lv,
.comment-item__meta .amd-badge .amd-lv,
.js-comm .amd-badge .amd-lv {
	font-size: 10px;
}
.amd-title-tip {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	vertical-align: middle;
	position: relative;
	overflow: visible;
}
.comment-item__meta .amd-titles,
.comment-item__meta .amd-title-tip,
.js-comm .amd-titles,
.js-comm .amd-title-tip {
	overflow: visible;
}
.rank-tip--title-reviews .rank-tip__name { color: var(--amd-tt-reviews-ico); }
.rank-tip--title-comments .rank-tip__name { color: var(--amd-tt-comments-ico); }
.rank-tip--title-series .rank-tip__name { color: var(--amd-tt-series-ico); }
.rank-tip--title-blog .rank-tip__name { color: var(--amd-tt-blog-ico); }
.rank-tip--title-friends .rank-tip__name { color: var(--amd-tt-friends-ico); }
.amd-badge--lg .amd-t {
	font-size: 15px;
}
.amd-badge--lg .amd-ico,
.amd-badge--lg .amd-ico svg {
	width: 18px;
	height: 18px;
}
.amd-badge--lg .amd-lv {
	font-size: 11px;
}
.amd-badge .amd-ico {
	position: relative;
	z-index: 2;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 15px;
	height: 15px;
}
.amd-badge--reviews .amd-ico { color: var(--amd-tt-reviews-ico, #2563eb) !important; }
.amd-badge--comments .amd-ico { color: var(--amd-tt-comments-ico, #7c3aed) !important; }
.amd-badge--series .amd-ico { color: var(--amd-tt-series-ico, #e11d48) !important; }
.amd-badge--blog .amd-ico { color: var(--amd-tt-blog-ico, #dc2626) !important; }
.amd-badge--friends .amd-ico { color: var(--amd-tt-friends-ico, #ea580c) !important; }
.amd-badge svg {
	position: relative;
	z-index: 1;
	flex-shrink: 0;
	filter: saturate(var(--rank-sat)) brightness(var(--rank-br)) contrast(var(--rank-ct));
}
.amd-badge .amd-lv {
	position: absolute;
	right: -1px;
	bottom: 0;
	z-index: 3;
	font-size: 10px;
	font-weight: 800;
	line-height: 1;
	color: var(--amd-tt-lv-color, #14141c);
	font-variant-numeric: tabular-nums;
	letter-spacing: -.04em;
	pointer-events: none;
	text-shadow: var(--amd-tt-lv-shadow, 0 0 1px #fff, 0 1px 0 rgba(255, 255, 255, .92), -1px 0 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, 0 0 2px rgba(20, 20, 28, .25));
}
.amd-badge .amd-t {
	font-weight: 600;
	font-size: 12px;
	line-height: 1.1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
	flex: 1 1 auto;
	position: relative;
	z-index: 2;
	display: inline-block;
	padding-bottom: .04em;
	opacity: 1;
	-webkit-font-smoothing: antialiased;
}
.amd-badge--comments .amd-t,
.amd-badge--reviews .amd-t,
.amd-badge--series .amd-t,
.amd-badge--blog .amd-t {
	font-weight: 700;
	letter-spacing: .01em;
	background-image: none !important;
	background-clip: border-box !important;
	-webkit-background-clip: border-box !important;
	text-shadow: var(--amd-tt-text-shadow, none);
}
.amd-badge--reviews .amd-t {
	color: var(--amd-tt-reviews-text, #1d4ed8) !important;
	-webkit-text-fill-color: var(--amd-tt-reviews-text, #1d4ed8) !important;
}
.amd-badge--comments .amd-t {
	color: var(--amd-tt-comments-text, #5b21b6) !important;
	-webkit-text-fill-color: var(--amd-tt-comments-text, #5b21b6) !important;
}
.amd-badge--series .amd-t {
	color: var(--amd-tt-series-text, #be123c) !important;
	-webkit-text-fill-color: var(--amd-tt-series-text, #be123c) !important;
}
.amd-badge--blog .amd-t {
	color: var(--amd-tt-blog-text, #dc2626) !important;
	-webkit-text-fill-color: var(--amd-tt-blog-text, #dc2626) !important;
}
.amd-badge--friends .amd-t {
	font-weight: 700;
	background-image: linear-gradient(90deg, var(--amd-tt-friends-text1, #c2410c) 0%, var(--amd-tt-friends-text2, #ea580c) 100%) !important;
	background-clip: text !important;
	-webkit-background-clip: text !important;
	-webkit-text-fill-color: transparent !important;
	color: transparent !important;
	text-shadow: var(--amd-tt-text-shadow, none);
}
.amd-fx-glow,
.amd-fx-pulse,
.amd-fx-shimmer-wrap,
.amd-fx-halo {
	position: absolute;
	inset: 0;
	border-radius: 9999px;
	pointer-events: none;
	z-index: -1;
}
.amd-fx-glow {
	animation: title-fx-glow calc(3s / var(--fx-sp, 1)) ease-in-out infinite;
	filter: opacity(var(--fx-op, 1));
}
.amd-fx-pulse {
	inset: calc(-2px * var(--fx-sz, 1));
	animation: title-fx-pulse calc(2.4s / var(--fx-sp, 1)) ease-in-out infinite;
	opacity: var(--fx-op, 1);
	z-index: -1;
}
.amd-fx-shimmer-wrap {
	overflow: hidden;
	z-index: 0;
	opacity: var(--fx-op, 1);
}
.amd-fx-shimmer {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: calc(40% * var(--fx-sz, 1));
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
	animation: title-fx-shimmer calc(3.4s / var(--fx-sp, 1)) linear infinite;
}
.amd-fx-halo {
	transform: scale(1.15);
	filter: blur(18px);
	opacity: calc(.06 + .2 * var(--fx-op, 1));
	z-index: -1;
	animation: title-fx-constellation-halo calc(6s / var(--fx-sp, 1)) ease-in-out infinite;
}

.comment-item__meta .amd-badge,
.comment-item__meta .amd-titles {
	margin: 0 !important;
}
.usp__name-row .amd-titles .amd-badge--lg,
.usp__name-row .amd-title-tip .amd-badge--lg {
	height: 36px;
	padding: 0 16px;
}

/* Попап нового титула */
.title-modal-backdrop {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(10, 11, 16, .62);
	backdrop-filter: blur(8px);
	opacity: 0;
	visibility: hidden;
	transition: .25s ease;
	z-index: 10050;
}
.title-modal-backdrop.show {
	opacity: 1;
	visibility: visible;
}
.title-modal {
	--title-accent: #9b8cff;
	--title-accent2: #c2b9ff;
	--title-glow: rgba(155, 140, 255, .28);
	--title-text: #a59be7;
	position: relative;
	width: min(440px, 100%);
	padding: 34px 32px 28px;
	border-radius: 24px;
	overflow: hidden;
	text-align: center;
	color: #f7f8fb;
	background:
		radial-gradient(circle at 50% -20%, color-mix(in srgb, var(--title-accent) 22%, transparent), transparent 44%),
		linear-gradient(180deg, #1a1d29, #12151e);
	border: 1px solid rgba(255, 255, 255, .08);
	box-shadow: 0 28px 80px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .035);
	transform: translateY(18px) scale(.97);
	opacity: 0;
	transition: .32s cubic-bezier(.2, .8, .2, 1);
}
.title-modal-backdrop.show .title-modal {
	transform: translateY(0) scale(1);
	opacity: 1;
}
.title-modal::before {
	content: "";
	position: absolute;
	width: 300px;
	height: 300px;
	left: 50%;
	top: -220px;
	transform: translateX(-50%);
	border-radius: 50%;
	background: radial-gradient(circle, color-mix(in srgb, var(--title-accent) 28%, transparent), transparent 68%);
	pointer-events: none;
}
.title-modal__close {
	position: absolute;
	right: 14px;
	top: 14px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 10px;
	color: #8d92a2;
	background: rgba(255, 255, 255, .035);
	cursor: pointer;
	font-size: 18px;
	transition: .18s ease;
}
.title-modal__close:hover {
	color: #fff;
	background: rgba(255, 255, 255, .07);
}
.title-modal__icon {
	position: relative;
	width: 66px;
	height: 66px;
	margin: 0 auto 18px;
	border-radius: 21px;
	display: grid;
	place-items: center;
	color: #fff;
	background: linear-gradient(145deg, var(--title-accent), var(--title-accent2));
	box-shadow: 0 14px 32px var(--title-glow), 0 0 28px var(--title-glow);
}
.title-modal__icon::after {
	content: "";
	position: absolute;
	inset: -8px;
	border-radius: 27px;
	border: 1px solid color-mix(in srgb, var(--title-accent) 28%, transparent);
}
.title-modal__icon svg {
	width: 28px;
	height: 28px;
}
.title-modal__eyebrow {
	color: var(--title-text);
	font-size: 10px;
	font-weight: 900;
	letter-spacing: .16em;
	text-transform: uppercase;
	margin-bottom: 8px;
}
.title-modal h2 {
	margin: 0;
	font-size: 28px;
	line-height: 1.1;
	letter-spacing: -.035em;
	color: #f7f8fb;
}
.title-modal__text {
	margin: 10px auto 0;
	max-width: 330px;
	color: #9ca2b3;
	font-size: 13px;
	line-height: 1.65;
}
.new-title-badge-wrap {
	position: relative;
	display: flex;
	justify-content: center;
	margin: 24px 0 22px;
}
.title-modal__reward {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	margin-bottom: 20px;
	color: #8f94a4;
	font-size: 10.5px;
}
.title-modal__reward b {
	color: var(--title-accent2);
	font-weight: 800;
}
.title-modal__button {
	width: 100%;
	border: 0;
	cursor: pointer;
	padding: 14px 18px;
	border-radius: 13px;
	color: #171821;
	font-weight: 900;
	background: linear-gradient(90deg, var(--title-accent2), var(--title-accent));
	box-shadow: 0 10px 24px var(--title-glow);
	transition: .18s ease;
}
.title-modal__button:hover {
	transform: translateY(-1px);
}
.title-modal .particle {
	position: absolute;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--title-accent);
	opacity: 0;
	pointer-events: none;
}
.title-modal .p1 { left: 18%; top: 30%; animation: amd-title-particle 2.8s .2s ease-out infinite; }
.title-modal .p2 { right: 18%; top: 25%; animation: amd-title-particle 3.2s .8s ease-out infinite; }
.title-modal .p3 { left: 27%; top: 18%; animation: amd-title-particle 3.5s 1.4s ease-out infinite; }
.title-modal .p4 { right: 28%; top: 38%; animation: amd-title-particle 3s 1.1s ease-out infinite; }
@keyframes amd-title-particle {
	0% { transform: translateY(8px) scale(.6); opacity: 0; }
	20% { opacity: .8; }
	100% { transform: translateY(-28px) scale(1.1); opacity: 0; }
}

/* Выбор в «Стили» — основные стили в AvatarSelect/style.css */
.ava-modal .ava-titles-body .amd-badge {
	flex-shrink: 0;
	position: relative;
}

/* Светлая тема — явные светлые бейджи (перебивает старый inline из кэша комментов) */
body:not(.dt-is-active) .amd-badge--reviews {
	background: #eff6ff !important;
	border-color: rgba(96, 165, 250, .75) !important;
}
body:not(.dt-is-active) .amd-badge--comments {
	background: #f7f3ff !important;
	border-color: rgba(124, 77, 255, .45) !important;
}
body:not(.dt-is-active) .amd-badge--series {
	background: #fff5f7 !important;
	border-color: rgba(220, 38, 38, .35) !important;
}
body:not(.dt-is-active) .amd-badge--blog {
	background: #fff5f5 !important;
	border-color: rgba(220, 38, 38, .45) !important;
}
body:not(.dt-is-active) .amd-badge--friends {
	background: #fff8f0 !important;
	border-color: rgba(251, 146, 60, .45) !important;
}
body:not(.dt-is-active) .amd-badge--reviews .amd-t {
	color: #1d4ed8 !important;
	-webkit-text-fill-color: #1d4ed8 !important;
}
body:not(.dt-is-active) .amd-badge--comments .amd-t {
	color: #5b21b6 !important;
	-webkit-text-fill-color: #5b21b6 !important;
}
body:not(.dt-is-active) .amd-badge--series .amd-t {
	color: #be123c !important;
	-webkit-text-fill-color: #be123c !important;
}
body:not(.dt-is-active) .amd-badge--blog .amd-t {
	color: #dc2626 !important;
	-webkit-text-fill-color: #dc2626 !important;
}
body:not(.dt-is-active) .amd-badge .amd-lv {
	color: #14141c !important;
	text-shadow: 0 0 1px #fff, 0 1px 0 rgba(255, 255, 255, .92), -1px 0 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, 0 0 2px rgba(20, 20, 28, .25) !important;
}

/* Тёмная тема — запасные значения, если common.css ещё не обновлён */
.dt-is-active .amd-badge--reviews {
	background: var(--amd-tt-reviews-bg, #0f172a) !important;
	border-color: var(--amd-tt-reviews-border, rgba(96, 165, 250, .75)) !important;
}
.dt-is-active .amd-badge--comments {
	background: var(--amd-tt-comments-bg, #16121f) !important;
	border-color: var(--amd-tt-comments-border, rgba(124, 77, 255, .45)) !important;
}
.dt-is-active .amd-badge--series {
	background: var(--amd-tt-series-bg, #181218) !important;
	border-color: var(--amd-tt-series-border, rgba(220, 38, 38, .35)) !important;
}
.dt-is-active .amd-badge--blog {
	background: var(--amd-tt-blog-bg, #16080a) !important;
	border-color: var(--amd-tt-blog-border, rgba(255, 0, 0, .55)) !important;
}
.dt-is-active .amd-badge--friends {
	background: var(--amd-tt-friends-bg, #18140e) !important;
	border-color: var(--amd-tt-friends-border, rgba(251, 146, 60, .45)) !important;
}
.dt-is-active .amd-badge--reviews .amd-ico { color: var(--amd-tt-reviews-ico, #bae6fd) !important; }
.dt-is-active .amd-badge--comments .amd-ico { color: var(--amd-tt-comments-ico, #ddd6fe) !important; }
.dt-is-active .amd-badge--series .amd-ico { color: var(--amd-tt-series-ico, #ff6b9d) !important; }
.dt-is-active .amd-badge--blog .amd-ico { color: var(--amd-tt-blog-ico, #ff8080) !important; }
.dt-is-active .amd-badge--friends .amd-ico { color: var(--amd-tt-friends-ico, #fb923c) !important; }
.dt-is-active .amd-badge--reviews .amd-t {
	color: var(--amd-tt-reviews-text, #e0f2fe) !important;
	-webkit-text-fill-color: var(--amd-tt-reviews-text, #e0f2fe) !important;
}
.dt-is-active .amd-badge--comments .amd-t {
	color: var(--amd-tt-comments-text, #f5f0ff) !important;
	-webkit-text-fill-color: var(--amd-tt-comments-text, #f5f0ff) !important;
}
.dt-is-active .amd-badge--series .amd-t {
	color: var(--amd-tt-series-text, #ffd6e8) !important;
	-webkit-text-fill-color: var(--amd-tt-series-text, #ffd6e8) !important;
}
.dt-is-active .amd-badge--blog .amd-t {
	color: var(--amd-tt-blog-text, #ffc9c9) !important;
	-webkit-text-fill-color: var(--amd-tt-blog-text, #ffc9c9) !important;
}
.dt-is-active .amd-badge--friends .amd-t {
	background-image: linear-gradient(90deg, var(--amd-tt-friends-text1, #ffb347) 0%, var(--amd-tt-friends-text2, #ea580c) 100%) !important;
	-webkit-text-fill-color: transparent !important;
}
.dt-is-active .amd-badge--comments .amd-t,
.dt-is-active .amd-badge--reviews .amd-t,
.dt-is-active .amd-badge--series .amd-t,
.dt-is-active .amd-badge--blog .amd-t {
	text-shadow: var(--amd-tt-text-shadow, 0 1px 2px rgba(0, 0, 0, .35));
}
.dt-is-active .amd-badge .amd-lv {
	color: var(--amd-tt-lv-color, #fff) !important;
	text-shadow: var(--amd-tt-lv-shadow, 0 0 2px #000, 0 1px 1px #000, -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000) !important;
}

@media (prefers-reduced-motion: reduce) {
	.amd-fx-glow,
	.amd-fx-pulse,
	.amd-fx-shimmer,
	.amd-fx-halo,
	.title-modal .particle {
		animation: none !important;
	}
}

/* Комменты: титулы отдельной строкой под ником на мобильной */
@media (max-width: 767px) {
	.comment-item__meta,
	.comment-item > .comment-item__main > .comment-item__header.d-flex > .comment-item__meta.flex-grow-1,
	.comment-item__header--stack .comment-item__meta,
	.ac-comments .comment-item__header .comment-item__meta,
	.clans-wall.ac-comments .comment-item__header .comment-item__meta {
		flex-wrap: wrap !important;
		overflow-x: visible !important;
		row-gap: 2px;
	}
	.comment-item__meta .amd-titles,
	.ac-comments .comment-item__header .amd-titles,
	.clans-wall.ac-comments .comment-item__header .amd-titles,
	.js-comm .amd-titles {
		flex: 0 0 100%;
		width: 100%;
		max-width: 100%;
		margin-left: 0 !important;
		margin-top: 2px;
		justify-content: flex-start;
	}
}
