/* Fan Market – Generador de letras bonitas */

.fmlb {
	--fmlb-primary: #7c3aed;
	--fmlb-accent: #ec4899;
	--fmlb-bg: #ffffff;
	--fmlb-card: #f6f5fb;
	--fmlb-text: #1f1b2e;
	--fmlb-muted: #6b6880;
	--fmlb-radius: 16px;
	--fmlb-font: inherit;
	--fmlb-grad: linear-gradient(120deg, var(--fmlb-primary), var(--fmlb-accent));
	--fmlb-ring: color-mix(in srgb, var(--fmlb-primary) 22%, transparent);
	--fmlb-line: color-mix(in srgb, var(--fmlb-text) 10%, transparent);
	--fmlb-cols: 2;

	position: relative;
	box-sizing: border-box;
	max-width: 1180px;
	margin: 0 auto;
	padding: clamp(18px, 3vw, 36px);
	background: var(--fmlb-bg);
	color: var(--fmlb-text);
	font-family: var(--fmlb-font);
	border-radius: calc(var(--fmlb-radius) * 1.5);
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}
.fmlb *, .fmlb *::before, .fmlb *::after { box-sizing: border-box; }
.fmlb--cols-1 { --fmlb-cols: 1; }
.fmlb--cols-3 { --fmlb-cols: 3; }

/* ---------- Cabecera ---------- */
.fmlb-head { text-align: center; margin: 0 auto 22px; max-width: 720px; }
.fmlb .fmlb-title {
	margin: 0 0 8px;
	font-family: var(--fmlb-font);
	font-size: clamp(26px, 4vw, 40px);
	line-height: 1.1;
	font-weight: 800;
	letter-spacing: -0.02em;
	background: var(--fmlb-grad);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.fmlb .fmlb-sub { margin: 0; color: var(--fmlb-muted); font-size: clamp(15px, 1.6vw, 17px); }

/* ---------- Campo de texto ---------- */
.fmlb-inputbar {
	position: sticky;
	top: 12px;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 760px;
	margin: 0 auto 16px;
	padding: 6px 8px 6px 16px;
	background: var(--fmlb-bg);
	border: 2px solid var(--fmlb-line);
	border-radius: 999px;
	box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--fmlb-primary) 35%, transparent);
	transition: border-color .2s, box-shadow .2s;
}
.fmlb-inputbar:focus-within {
	border-color: var(--fmlb-primary);
	box-shadow: 0 0 0 5px var(--fmlb-ring), 0 10px 30px -12px color-mix(in srgb, var(--fmlb-primary) 45%, transparent);
}
.fmlb-inputicon {
	flex: none;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--fmlb-grad);
	color: #fff;
	font-weight: 800;
	font-size: 15px;
}
.fmlb .fmlb-input {
	flex: 1;
	min-width: 0;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	box-shadow: none;
	color: var(--fmlb-text);
	font: 500 clamp(16px, 2vw, 19px)/1.2 var(--fmlb-font);
}
.fmlb .fmlb-input::placeholder { color: var(--fmlb-muted); opacity: .8; }
.fmlb .fmlb-clear {
	flex: none;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fmlb-card);
	color: var(--fmlb-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.fmlb .fmlb-clear:hover { color: var(--fmlb-text); }
.fmlb .fmlb-clear[hidden] { display: none; }

/* ---------- Filtros ---------- */
.fmlb-filters {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
	margin: 0 auto 22px;
}
.fmlb-filters[hidden] { display: none; }
.fmlb .fmlb-chip {
	margin: 0;
	padding: 8px 16px;
	border: 1.5px solid var(--fmlb-line);
	border-radius: 999px;
	background: var(--fmlb-bg);
	color: var(--fmlb-text);
	font: 600 14px/1 var(--fmlb-font);
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.fmlb .fmlb-chip:hover { border-color: var(--fmlb-primary); transform: translateY(-1px); }
.fmlb .fmlb-chip.is-active { background: var(--fmlb-grad); border-color: transparent; color: #fff; }

/* ---------- Distribución ---------- */
.fmlb-body { display: grid; gap: 24px; align-items: start; }
.fmlb--has-side .fmlb-body { grid-template-columns: minmax(0, 1fr) 300px; }
.fmlb-results {
	display: grid;
	grid-template-columns: repeat(var(--fmlb-cols), minmax(0, 1fr));
	gap: 12px;
}

/* ---------- Tarjetas ---------- */
.fmlb .fmlb-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 14px 16px 16px;
	border: 1.5px solid transparent;
	border-radius: var(--fmlb-radius);
	background: var(--fmlb-card);
	color: var(--fmlb-text);
	text-align: left;
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	overflow: hidden;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
	animation: fmlb-in .35s ease both;
	animation-delay: calc(var(--i, 0) * 18ms);
}
.fmlb .fmlb-card[hidden] { display: none; }
.fmlb--card-shadow .fmlb-card { box-shadow: 0 1px 2px rgba(20, 10, 50, .06), 0 6px 16px -10px rgba(20, 10, 50, .25); }
.fmlb--card-border .fmlb-card { border-color: var(--fmlb-line); background: var(--fmlb-bg); }
.fmlb .fmlb-card:hover,
.fmlb .fmlb-card:focus-visible {
	transform: translateY(-2px);
	border-color: color-mix(in srgb, var(--fmlb-primary) 45%, transparent);
	box-shadow: 0 12px 26px -14px color-mix(in srgb, var(--fmlb-primary) 60%, transparent);
	outline: none;
	background: var(--fmlb-card);
}
.fmlb--card-border .fmlb-card:hover { background: var(--fmlb-bg); }
.fmlb .fmlb-card.is-selected { border-color: var(--fmlb-primary); }

.fmlb-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fmlb-card-name {
	color: var(--fmlb-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}
.fmlb-card-copy {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--fmlb-bg);
	color: var(--fmlb-primary);
	font-size: 12.5px;
	font-weight: 700;
	white-space: nowrap;
	transition: background .15s, color .15s;
}
.fmlb .fmlb-card:hover .fmlb-card-copy { background: var(--fmlb-grad); color: #fff; }
.fmlb .fmlb-card.is-copied .fmlb-card-copy { background: #16a34a; color: #fff; }
.fmlb-card-out {
	display: block;
	font-size: clamp(18px, 2vw, 22px);
	line-height: 1.5;
	font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Symbols", "Noto Sans Math", "Apple Color Emoji", "Segoe UI Symbol", sans-serif;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-height: 1.5em;
}
.fmlb.is-sample .fmlb-card-out { opacity: .55; }

.fmlb .fmlb-card.is-copied::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: var(--fmlb-grad);
	opacity: 0;
	animation: fmlb-flash .6s ease;
	pointer-events: none;
}

/* ---------- Lateral ---------- */
.fmlb-side { position: sticky; top: 84px; display: grid; gap: 16px; }

.fmlb-bio {
	padding: 16px;
	border-radius: var(--fmlb-radius);
	background: var(--fmlb-card);
}
.fmlb-bio-label { margin-bottom: 10px; color: var(--fmlb-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fmlb-bio-phone {
	padding: 16px;
	border-radius: calc(var(--fmlb-radius) * .8);
	background: #fff;
	color: #111;
	border: 1px solid rgba(0, 0, 0, .06);
	box-shadow: 0 10px 24px -16px rgba(0, 0, 0, .35);
}
.fmlb-bio-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.fmlb-bio-avatar {
	flex: none;
	display: grid;
	place-items: center;
	width: 62px;
	height: 62px;
	padding: 3px;
	border-radius: 50%;
	background: var(--fmlb-grad);
}
.fmlb-bio-avatar span {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	border: 3px solid #fff;
	border-radius: 50%;
	background: #f1eff7;
	color: var(--fmlb-primary);
	font-size: 22px;
}
.fmlb-bio-stats { display: flex; flex: 1; justify-content: space-around; gap: 6px; text-align: center; min-width: 0; }
.fmlb-bio-stat { min-width: 0; }
.fmlb-bio-stat strong { display: block; font-size: 14px; white-space: nowrap; }
.fmlb-bio-stat span { display: block; font-size: 10.5px; color: #666; overflow: hidden; text-overflow: ellipsis; }
.fmlb-bio-user { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.fmlb-bio-text {
	font-size: 15px;
	line-height: 1.45;
	word-break: break-word;
	font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Symbols", "Noto Sans Math", sans-serif;
}
.fmlb-bio-count { margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--fmlb-muted); text-align: right; }
.fmlb-bio-count.is-over { color: #dc2626; }
.fmlb-bio-hint { margin-top: 2px; font-size: 12.5px; color: var(--fmlb-muted); }

/* ---------- Llamada a la acción ---------- */
.fmlb-cta {
	position: relative;
	padding: 20px;
	border-radius: var(--fmlb-radius);
	background: var(--fmlb-grad);
	color: #fff;
	overflow: hidden;
}
.fmlb-cta::before {
	content: "";
	position: absolute;
	right: -40px;
	top: -40px;
	width: 140px;
	height: 140px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
}
.fmlb-cta-title { position: relative; font-size: 18px; font-weight: 800; line-height: 1.2; margin-bottom: 6px; }
.fmlb .fmlb-cta-text { position: relative; margin: 0 0 14px; font-size: 14.5px; opacity: .95; color: #fff; }
.fmlb .fmlb-cta-btn {
	position: relative;
	display: inline-block;
	padding: 11px 20px;
	border-radius: 999px;
	background: #fff;
	color: var(--fmlb-primary);
	font-weight: 800;
	font-size: 15px;
	text-decoration: none;
	box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35);
	transition: transform .15s;
}
.fmlb .fmlb-cta-btn:hover { transform: translateY(-2px); color: var(--fmlb-primary); text-decoration: none; }

.fmlb-pop {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99998;
	width: min(340px, calc(100vw - 32px));
	box-shadow: 0 24px 50px -20px rgba(30, 10, 60, .6);
	transform: translateY(24px) scale(.96);
	opacity: 0;
	visibility: hidden;
	transition: transform .35s cubic-bezier(.2, .9, .3, 1.2), opacity .25s, visibility .35s;
}
.fmlb-pop.is-visible { transform: none; opacity: 1; visibility: visible; }
.fmlb .fmlb-pop-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 1;
	width: 30px;
	height: 30px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .22);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

/* ---------- Aviso "copiado" ---------- */
.fmlb-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 99999;
	padding: 12px 20px;
	border-radius: 999px;
	background: #1f1b2e;
	color: #fff;
	font: 600 15px/1.2 var(--fmlb-font);
	box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5);
	transform: translate(-50%, 20px);
	opacity: 0;
	pointer-events: none;
	transition: transform .25s ease, opacity .25s ease;
	white-space: nowrap;
	max-width: calc(100vw - 32px);
	overflow: hidden;
	text-overflow: ellipsis;
}
.fmlb-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
	.fmlb--has-side .fmlb-body { grid-template-columns: minmax(0, 1fr); }
	.fmlb-side { position: static; order: -1; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
	.fmlb-results { grid-template-columns: repeat(min(var(--fmlb-cols), 2), minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.fmlb { padding: 16px 12px; border-radius: var(--fmlb-radius); }
	.fmlb-results { grid-template-columns: minmax(0, 1fr); gap: 10px; }
	.fmlb--has-pop .fmlb-side .fmlb-cta { display: none; } /* en móvil basta con el aviso al copiar */
	.fmlb-bio-hint { display: none; }
	.fmlb-inputbar { top: 8px; }
	.fmlb .fmlb-card { padding: 12px 14px 14px; }
	.fmlb-pop { left: 16px; right: 16px; bottom: 16px; width: auto; }
	.fmlb-toast { top: 16px; bottom: auto; transform: translate(-50%, -20px); }
	.fmlb-bio { padding: 12px; }
	.fmlb-bio-label { display: none; }
	.fmlb-bio-avatar { width: 50px; height: 50px; }
}

@keyframes fmlb-pulse { 0%, 100% { transform: none; } 30% { transform: scale(1.035); } 60% { transform: scale(.99); } }
.fmlb-cta.is-pulse { animation: fmlb-pulse .7s ease; }

/* ---------- Animaciones ---------- */
@keyframes fmlb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fmlb-flash { 0% { opacity: .35; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
	.fmlb *, .fmlb *::before, .fmlb *::after { animation: none !important; transition: none !important; }
}
