.rtb-widget {
	--rtb-accent: #66CC99;
	--rtb-accent-rgb: 102,204,153;
	--rtb-dark: #151B49;
	--rtb-border: #ebebeb;
	box-sizing: border-box;
	max-width: 720px;
	margin: 24px auto;
	padding: 20px;
	background: #fff;
	border: 1px solid var(--rtb-border);
	border-radius: 14px;
	font-family: inherit;
	contain: layout; /* évite les répercussions de layout sur le reste de la page */
}
.rtb-widget * { box-sizing: border-box; }
.rtb-widget img { -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; }

.rtb-pool {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-bottom: 20px;
	min-height: 1px; /* réserve de l'espace avant hydratation JS, anti-CLS */
}
@media (max-width: 480px) {
	.rtb-pool { grid-template-columns: repeat(3, 1fr); }
}

.rtb-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 8px;
	background: #fafafa;
	border: 1px solid var(--rtb-border);
	border-radius: 10px;
	cursor: grab;
	user-select: none;
	touch-action: none;
	transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.rtb-card:active { cursor: grabbing; }
.rtb-card.is-used { opacity: .35; pointer-events: none; }
.rtb-card.is-dragging { box-shadow: 0 8px 20px rgba(0,0,0,.18); transform: scale(1.04); z-index: 5; }
.rtb-card.is-selected { outline: 3px solid var(--rtb-accent); box-shadow: 0 0 0 4px rgba(var(--rtb-accent-rgb), .35); background: rgba(var(--rtb-accent-rgb), .12); }
.rtb-card img, .rtb-card-placeholder {
	width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #e2e2e2;
	display: block;
}
.rtb-card-placeholder { background: linear-gradient(180deg,#e6e6e6,#d7d7d7); }
.rtb-card-name { font-size: 13px; font-weight: 600; color: var(--rtb-dark); text-align: center; line-height: 1.2; }

.rtb-ranking {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
	gap: 10px;
	margin-bottom: 16px;
	padding: 14px;
	background: #f6f7fb;
	border-radius: 12px;
	min-height: 96px;
}
.rtb-slot {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 96px;
	border: 2px dashed #c7cbe0;
	border-radius: 10px;
	background: #fff;
	transition: border-color .15s ease, background .15s ease;
	padding: 8px 4px;
}
.rtb-slot.is-over { border-color: var(--rtb-accent); background: rgba(var(--rtb-accent-rgb), .12); }
.rtb-slot.is-filled { border-style: solid; border-color: var(--rtb-accent); }
.rtb-slot-rank {
	position: absolute;
	top: -10px; left: -10px;
	width: 26px; height: 26px;
	border-radius: 50%;
	background: var(--rtb-dark);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	display: flex; align-items: center; justify-content: center;
}
.rtb-slot-empty { font-size: 11px; color: #999; text-align: center; }
.rtb-slot img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.rtb-slot-name { font-size: 12px; font-weight: 600; color: var(--rtb-dark); text-align: center; }
.rtb-slot-remove {
	position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
	background: #e03b3b; color: #fff; border: 2px solid #fff; padding: 0; margin: 0;
	display: flex; align-items: center; justify-content: center; line-height: 0;
	cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.rtb-slot-remove svg { width: 10px; height: 10px; display: block; }

.rtb-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.rtb-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer;
	font-weight: 700; font-size: 14px; text-decoration: none;
	background: var(--rtb-accent); color: var(--rtb-dark);
	transition: background .15s ease, color .15s ease;
}
/* Icône et libellé en éléments séparés (plutôt qu'un simple espace texte
   après l'emoji) : certains emojis (ex. ✨) laissent un espacement visuel
   quasi nul après un simple caractère espace selon la police système,
   contrairement à d'autres symboles (ex. ⟲) -- le "gap" du flex ci-dessus
   garantit un espacement identique et fiable dans tous les cas. */
.rtb-btn-icon { display: inline-flex; line-height: 1; }
.rtb-btn:hover { background: #000; color: #FFD200; }
.rtb-btn-reset { background: #f1f1f1; color: #555; }
.rtb-btn[disabled] { opacity: .5; cursor: not-allowed; }

.rtb-result { margin-top: 18px; text-align: center; }
.rtb-canvas { width: 100%; max-width: 340px; height: auto; border-radius: 14px; border: 1px solid var(--rtb-border); aspect-ratio: 1080 / 1350; }
.rtb-share { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.rtb-share-note { font-size: 12px; color: #777; margin-top: 8px; }


@media (max-width: 380px) {
	.rtb-widget { padding: 14px; margin: 14px 0; border-radius: 10px; }
}

/* Vue "résultat" (lien de partage individuel, ?rtb_r=<id>) : l'image
   générée par un ami, en grand, avec un bouton pour venir créer son
   propre Top. Volontairement une classe distincte de .rtb-widget (et non
   une variante) pour que le JS du widget interactif -- qui cible
   spécifiquement .rtb-widget -- ne tente jamais de s'initialiser dessus. */
.rtb-result-page {
	--rtb-accent: #66CC99;
	--rtb-accent-rgb: 102,204,153;
	--rtb-dark: #151B49;
	--rtb-border: #ebebeb;
	box-sizing: border-box;
	/* Alignée sur la largeur du widget interactif (.rtb-widget, 720px),
	   jugée confortable -- au lieu des 420px d'origine, trop étroits par
	   rapport au texte de l'article. */
	max-width: 720px;
	margin: 24px auto;
	padding: 20px;
	background: #fff;
	border: 1px solid var(--rtb-border);
	border-radius: 14px;
	text-align: center;
}
.rtb-result-view-image {
	display: block;
	width: 100%;
	border-radius: 10px;
	margin-bottom: 16px;
}
.rtb-result-view-cta-wrap { margin: 0; }
.rtb-result-view-cta { display: inline-flex; }
