/**
 * NB Fortuna spin engine styles.
 *
 * @copyright (C) 2026 Olvedi Hunor
 * @license   GNU General Public License version 2 or later
 */

.nbf {
	--nbf-size: 420px;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	transition: opacity 0.25s ease;
}

.nbf--swap {
	opacity: 0;
}

/* Chain breadcrumb */
.nbf-trail {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	font-size: 0.85rem;
	color: var(--gray-600, #6c757d);
}

.nbf-trail-item + .nbf-trail-item::before {
	content: "→";
	margin: 0 0.35rem;
	opacity: 0.6;
}

.nbf-trail-item--current {
	font-weight: 600;
	color: inherit;
}

/* Live readout of the slice under the pointer */
.nbf-readout {
	min-height: 1.6em;
	font-weight: 700;
	font-size: 1.1rem;
	text-align: center;
}

/* Wheel stage */
.nbf-stage {
	position: relative;
	width: var(--nbf-size);
	max-width: min(92vw, 100%);
	aspect-ratio: 1 / 1;
}

.nbf-svg {
	width: 100%;
	height: 100%;
	display: block;
}

.nbf-slice {
	stroke: #fff;
	stroke-width: 0.4;
	transition: opacity 0.4s ease;
}

.nbf-slice--dim {
	opacity: 0.35;
}

.nbf-slice--won {
	opacity: 1;
}

.nbf-slice-label {
	fill: #fff;
	paint-order: stroke;
	stroke: rgba(0, 0, 0, 0.35);
	stroke-width: 0.5;
	pointer-events: none;
	user-select: none;
}

.nbf-hub {
	fill: #fff;
	stroke: rgba(0, 0, 0, 0.25);
	stroke-width: 1;
}

.nbf-rim {
	fill: none;
	stroke: rgba(0, 0, 0, 0.35);
	stroke-width: 1.5;
}

/* Pointer at 12 o'clock */
.nbf-pointer {
	position: absolute;
	top: -6px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 14px solid transparent;
	border-right: 14px solid transparent;
	border-top: 26px solid var(--nbf-pointer-color, #d9534f);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
	z-index: 2;
}

/* Controls */
.nbf-controls {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
}

.nbf-name-input {
	padding: 0.45rem 0.75rem;
	border: 1px solid var(--gray-400, #ced4da);
	border-radius: 0.35rem;
	text-align: center;
	max-width: 16rem;
}

/* Optional slice groups */
.nbf-groups {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.35rem 1rem;
	font-size: 0.9rem;
	max-width: 36rem;
}

.nbf-groups-title {
	font-weight: 600;
}

.nbf-group {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	cursor: pointer;
	padding: 0.2rem 0.6rem;
	border: 1px solid var(--gray-400, #ced4da);
	border-radius: 1rem;
	user-select: none;
}

.nbf-group:has(.nbf-group-cb:checked) {
	background: var(--nbf-go-color, #1565c0);
	border-color: var(--nbf-go-color, #1565c0);
	color: #fff;
}

.nbf-group-cb:disabled {
	cursor: not-allowed;
}

.nbf-btn {
	border: 0;
	border-radius: 2rem;
	padding: 0.6rem 2.4rem;
	font-size: 1.05rem;
	font-weight: 700;
	cursor: pointer;
	color: #fff;
	background: var(--nbf-start-color, #2e7d32);
	transition: background 0.2s ease, transform 0.1s ease;
}

.nbf-btn:hover:not(:disabled) {
	transform: scale(1.04);
}

.nbf-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.nbf-btn--stop {
	background: var(--nbf-stop-color, #c62828);
}

.nbf-btn--go,
.nbf-btn--continue {
	background: var(--nbf-go-color, #1565c0);
	padding: 0.45rem 1.4rem;
	font-size: 0.95rem;
}

.nbf-preselect {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	font-size: 0.9rem;
}

.nbf-preselect-select {
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--gray-400, #ced4da);
	border-radius: 0.35rem;
	max-width: 16rem;
}

/* Result */
.nbf-result {
	text-align: center;
	max-width: 34rem;
}

.nbf-result-headline {
	font-size: 1.3rem;
	font-weight: 700;
	margin: 0.25rem 0;
}

.nbf-result-image {
	max-width: 200px;
	max-height: 200px;
	border-radius: 0.5rem;
	margin: 0.5rem auto;
}

.nbf-result-error {
	color: var(--nbf-stop-color, #c62828);
	font-weight: 600;
}

.nbf-result-next {
	color: var(--gray-600, #6c757d);
	font-style: italic;
}

/* Legend */
.nbf-legend {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.35rem 1rem;
	font-size: 0.85rem;
	max-width: 40rem;
}

.nbf-legend-dot {
	display: inline-block;
	width: 0.75em;
	height: 0.75em;
	border-radius: 50%;
	vertical-align: baseline;
}

/* Confetti */
.nbf-confetti {
	position: absolute;
	top: 40%;
	width: 8px;
	height: 12px;
	border-radius: 2px;
	pointer-events: none;
	animation: nbf-confetti-fall 2.2s ease-in forwards;
	z-index: 3;
}

@keyframes nbf-confetti-fall {
	0% {
		opacity: 1;
		transform: translate(0, 0) rotate(0deg);
	}
	100% {
		opacity: 0;
		transform: translate(var(--nbf-cx, 0), 70vh) rotate(var(--nbf-cr, 360deg));
	}
}

/* Compact mode (modules in narrow positions) */
.nbf--compact .nbf-trail,
.nbf--compact .nbf-legend {
	display: none;
}

.nbf--compact .nbf-readout {
	font-size: 0.95rem;
}

.nbf--compact .nbf-btn {
	padding: 0.45rem 1.6rem;
	font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
	.nbf,
	.nbf-btn,
	.nbf-slice {
		transition: none;
	}
}
