/**
 * RD Loterías en Vivo — estilos del bloque de resultados.
 * Todo vive bajo .rdlot para no chocar con el tema.
 */

.rdlot {
	--rdlot-fondo: #0b1220;
	--rdlot-panel: #131c2e;
	--rdlot-panel-alto: #1a2438;
	--rdlot-borde: rgba(255, 255, 255, .08);
	--rdlot-texto: #eef2f9;
	--rdlot-tenue: #93a1bb;
	--rdlot-acento: #22d3a6;
	--rdlot-radio: 16px;

	max-width: 1440px;
	margin: 0 auto;
	padding: clamp(16px, 3vw, 32px);
	background: radial-gradient(1200px 600px at 10% -10%, #1c2b4a 0%, transparent 60%), var(--rdlot-fondo);
	border-radius: var(--rdlot-radio);
	color: var(--rdlot-texto);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	line-height: 1.45;
	box-sizing: border-box;
}

.rdlot *,
.rdlot *::before,
.rdlot *::after {
	box-sizing: inherit;
}

/* ---------- Cabecera ---------- */

.rdlot-hero {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: flex-end;
	justify-content: space-between;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--rdlot-borde);
}

.rdlot-vivo {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 4px 11px;
	border-radius: 999px;
	background: rgba(34, 211, 166, .12);
	border: 1px solid rgba(34, 211, 166, .35);
	color: var(--rdlot-acento);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .12em;
}

.rdlot-vivo__punto {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--rdlot-acento);
	box-shadow: 0 0 0 0 rgba(34, 211, 166, .7);
	animation: rdlot-latido 2s infinite;
}

@keyframes rdlot-latido {
	0%   { box-shadow: 0 0 0 0 rgba(34, 211, 166, .7); }
	70%  { box-shadow: 0 0 0 9px rgba(34, 211, 166, 0); }
	100% { box-shadow: 0 0 0 0 rgba(34, 211, 166, 0); }
}

.rdlot-hero__titulo {
	margin: 10px 0 4px;
	font-size: clamp(24px, 3.6vw, 38px);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -.02em;
	color: #fff;
}

.rdlot-hero__sub {
	margin: 0;
	color: var(--rdlot-tenue);
	font-size: 15px;
}

.rdlot-hero__meta {
	text-align: right;
	margin-left: auto;
}

.rdlot-fecha {
	font-size: 14px;
	font-weight: 600;
	color: var(--rdlot-texto);
}

.rdlot-contadores {
	display: flex;
	gap: 14px;
	justify-content: flex-end;
	margin: 6px 0;
	color: var(--rdlot-tenue);
	font-size: 13px;
}

.rdlot-contadores strong {
	color: var(--rdlot-acento);
	font-size: 15px;
}

.rdlot-estado {
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: flex-end;
	color: var(--rdlot-tenue);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.rdlot-refrescar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 1px solid var(--rdlot-borde);
	border-radius: 8px;
	background: var(--rdlot-panel-alto);
	color: var(--rdlot-tenue);
	cursor: pointer;
	transition: color .15s, border-color .15s, transform .15s;
}

.rdlot-refrescar:hover {
	color: var(--rdlot-acento);
	border-color: var(--rdlot-acento);
}

.rdlot-refrescar.esta-cargando svg {
	animation: rdlot-girar .8s linear infinite;
}

@keyframes rdlot-girar {
	to { transform: rotate(360deg); }
}

/* ---------- Filtros ---------- */

.rdlot-filtros {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 20px 0 4px;
}

.rdlot-chip {
	--chip: var(--rdlot-acento);
	padding: 6px 14px;
	border: 1px solid var(--rdlot-borde);
	border-radius: 999px;
	background: var(--rdlot-panel);
	color: var(--rdlot-tenue);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all .15s;
}

.rdlot-chip:hover {
	color: #fff;
	border-color: var(--chip);
}

.rdlot-chip.is-activo {
	background: var(--chip);
	border-color: var(--chip);
	color: #0b1220;
	box-shadow: 0 4px 14px -4px var(--chip);
}

/* ---------- Rejilla de tarjetas ---------- */

.rdlot-cuerpo {
	margin-top: 22px;
	transition: opacity .2s;
}

.rdlot-cuerpo.esta-cargando {
	opacity: .45;
}

.rdlot-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
	/* Todas las tarjetas de una fila terminan a la misma altura. */
	align-items: stretch;
	gap: 18px;
}

/* Mismo criterio que en las entradas: las bancas con más sorteos van
   primero, para que cada fila junte tarjetas de alto parecido. */
.rdlot-card { order: 9; }
.rdlot-card:has(.rdlot-sorteo:nth-child(2)) { order: 8; }
.rdlot-card:has(.rdlot-sorteo:nth-child(3)) { order: 7; }
.rdlot-card:has(.rdlot-sorteo:nth-child(4)) { order: 6; }
.rdlot-card:has(.rdlot-sorteo:nth-child(5)) { order: 5; }
.rdlot-card:has(.rdlot-sorteo:nth-child(6)) { order: 4; }
.rdlot-card:has(.rdlot-sorteo:nth-child(7)) { order: 3; }
.rdlot-card:has(.rdlot-sorteo:nth-child(8)) { order: 2; }

.rdlot-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--rdlot-panel);
	border: 1px solid var(--rdlot-borde);
	border-radius: 14px;
	box-shadow: 0 12px 30px -18px rgba(0, 0, 0, .9);
	transition: transform .18s, box-shadow .18s, border-color .18s;
}

.rdlot-card:hover {
	transform: translateY(-3px);
	border-color: color-mix(in srgb, var(--marca) 55%, transparent);
	box-shadow: 0 18px 40px -20px var(--marca);
}

.rdlot-card__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 16px;
	background: linear-gradient(135deg, var(--marca) 0%, color-mix(in srgb, var(--marca) 72%, #000) 100%);
	color: var(--marca-texto);
}

/* Los logos del origen son apaisados y de proporciones muy dispares, así que se
   fija sólo el alto y se deja el ancho libre hasta un tope: encajarlos en un
   círculo los dejaba ilegibles. */
.rdlot-card__logo {
	height: 30px;
	width: auto;
	max-width: 86px;
	padding: 3px 6px;
	border-radius: 7px;
	background: rgba(255, 255, 255, .92);
	object-fit: contain;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .28);
}

.rdlot-card__titulo {
	margin: 0;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: .01em;
	color: inherit;
}

.rdlot-card__cuenta {
	margin-left: auto;
	min-width: 22px;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .22);
	font-size: 11px;
	font-weight: 700;
	text-align: center;
}

.rdlot-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 6px 16px 14px;
}

/* ---------- Sorteo ---------- */

/* Reparte entre los sorteos el alto que sobra, en vez de dejarlo todo al
   final de la tarjeta. */
.rdlot-sorteo {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 12px 0;
	border-bottom: 1px dashed var(--rdlot-borde);
}

.rdlot-sorteo:last-child {
	border-bottom: 0;
	padding-bottom: 2px;
}

.rdlot-sorteo__cab {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 9px;
}

.rdlot-sorteo__nombre {
	font-size: 13px;
	font-weight: 700;
	color: var(--rdlot-texto);
}

.rdlot-sorteo__fecha {
	flex-shrink: 0;
	padding: 2px 8px;
	border-radius: 6px;
	background: rgba(255, 255, 255, .06);
	color: var(--rdlot-tenue);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
}

.rdlot-sorteo__fecha.es-hoy {
	background: rgba(34, 211, 166, .14);
	color: var(--rdlot-acento);
}

/* ---------- Bolas ---------- */

/* Columnas de ancho fijo: los números quedan alineados de un sorteo a otro
   y los sorteos largos se parten en líneas completas. */
.rdlot-bolas {
	display: grid;
	grid-template-columns: repeat(auto-fill, 38px);
	justify-content: start;
	gap: 7px;
}

.rdlot-bola {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border-radius: 50%;
	background: linear-gradient(160deg, #f8fafc 0%, #cbd5e1 100%);
	color: #0b1220;
	font-size: 15px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .35);
}

.rdlot-bola--square {
	border-radius: 9px;
}

.rdlot-bola--red {
	background: linear-gradient(160deg, #f87171 0%, #b91c1c 100%);
	color: #fff;
}

.rdlot-bola--blue {
	background: linear-gradient(160deg, #60a5fa 0%, #1d4ed8 100%);
	color: #fff;
}

.rdlot-bola--green {
	background: linear-gradient(160deg, #4ade80 0%, #15803d 100%);
	color: #fff;
}

.rdlot-bola--yellow {
	background: linear-gradient(160deg, #fde047 0%, #ca8a04 100%);
	color: #1c1917;
}

.rdlot-bola.es-bonus {
	box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .18), 0 0 0 2px var(--rdlot-acento);
}

/* Destello al cambiar un número tras un refresco. */
.rdlot-bola.rdlot-nuevo {
	animation: rdlot-destello 1.4s ease-out;
}

@keyframes rdlot-destello {
	0%  { transform: scale(1.28); box-shadow: 0 0 0 6px rgba(34, 211, 166, .55); }
	60% { transform: scale(1); }
	100% { box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .35); }
}

/* ---------- Avisos y pie ---------- */

.rdlot-aviso {
	padding: 14px 16px;
	margin-bottom: 14px;
	border: 1px solid var(--rdlot-borde);
	border-radius: 10px;
	background: var(--rdlot-panel);
	color: var(--rdlot-tenue);
	font-size: 14px;
}

.rdlot-aviso--error {
	border-color: rgba(248, 113, 113, .4);
	color: #fca5a5;
}

.rdlot-aviso--tibio {
	border-color: rgba(253, 224, 71, .35);
	color: #fde047;
}

.rdlot-pie {
	margin-top: 22px;
	padding-top: 14px;
	border-top: 1px solid var(--rdlot-borde);
	color: var(--rdlot-tenue);
	font-size: 12px;
	text-align: center;
}

.rdlot-pie a {
	color: var(--rdlot-acento);
	text-decoration: none;
}

.rdlot-pie a:hover {
	text-decoration: underline;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
	.rdlot-hero {
		flex-direction: column;
		align-items: flex-start;
	}

	.rdlot-hero__meta {
		margin-left: 0;
		text-align: left;
	}

	.rdlot-contadores,
	.rdlot-estado {
		justify-content: flex-start;
	}

	.rdlot-grid {
		grid-template-columns: 1fr;
	}

	/* Una sola columna: sin filas que emparejar, vuelve a mandar el orden
	   de la fuente y el alto natural de cada tarjeta. */
	.rdlot-card,
	.rdlot-card:has(.rdlot-sorteo:nth-child(2)),
	.rdlot-card:has(.rdlot-sorteo:nth-child(3)),
	.rdlot-card:has(.rdlot-sorteo:nth-child(4)),
	.rdlot-card:has(.rdlot-sorteo:nth-child(5)),
	.rdlot-card:has(.rdlot-sorteo:nth-child(6)),
	.rdlot-card:has(.rdlot-sorteo:nth-child(7)),
	.rdlot-card:has(.rdlot-sorteo:nth-child(8)) {
		order: 0;
	}

	.rdlot-sorteo {
		flex: 0 0 auto;
	}

	.rdlot-bolas {
		grid-template-columns: repeat(auto-fill, 34px);
	}

	.rdlot-bola {
		width: 34px;
		height: 34px;
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rdlot-vivo__punto,
	.rdlot-bola.rdlot-nuevo,
	.rdlot-refrescar.esta-cargando svg {
		animation: none;
	}

	.rdlot-card:hover {
		transform: none;
	}
}
