/* Рулетка рефералов — нейтральные цвета сайта, зелень только акцентами */

.ref-wheel-page {
	--rw-brand: var(--global-brand, #00b352);
	--rw-brand-soft: rgba(0, 179, 82, 0.1);
	--rw-brand-line: rgba(0, 179, 82, 0.28);
	--rw-surface: var(--bg-secondary, #1a1b1e);
	--rw-surface-2: var(--primary-color, #141415);
	--rw-elev: var(--base-neutral, #222223);
	--rw-border: rgba(255, 255, 255, 0.08);
	--rw-border-subtle: rgba(255, 255, 255, 0.05);
	--rw-text: #ececec;
	--rw-muted: #8b8f97;
	--rw-radius: 12px;
	--rw-radius-sm: 9px;
	--rw-gap: 10px;

	max-width: 920px;
	margin: 0 auto;
	padding: 4px 0 28px;
	color: var(--rw-text);
	font-family: Montserrat, Inter, system-ui, -apple-system, sans-serif;
}

/* ── шапка ── */
.ref-wheel-head {
	position: relative;
	margin-bottom: var(--rw-gap);
	padding: 14px 16px;
	border-radius: var(--rw-radius);
	background: var(--rw-surface);
	border: 1px solid var(--rw-border-subtle);
	overflow: hidden;
}

.ref-wheel-head::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
	background-size: 28px 28px;
	mask-image: linear-gradient(120deg, #000 0%, transparent 70%);
	pointer-events: none;
	opacity: 0.7;
}

.ref-wheel-head__row {
	position: relative;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
}

.ref-wheel-head__copy {
	min-width: 0;
}

.ref-wheel-head__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
	padding: 3px 8px;
	border-radius: 999px;
	font-size: 0.62rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--rw-brand);
	background: var(--rw-brand-soft);
}

.ref-wheel-head__eyebrow::before {
	content: '';
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--rw-brand);
}

.ref-wheel-head__title {
	margin: 0 0 4px;
	font-size: clamp(1.1rem, 2.4vw, 1.35rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: #fff;
}

.ref-wheel-head__sub {
	margin: 0;
	max-width: 520px;
	font-size: 0.78rem;
	line-height: 1.45;
	color: var(--rw-muted);
}

.ref-wheel-head .ref-wheel-limit {
	flex-shrink: 0;
	max-width: 220px;
	padding: 8px 10px;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.28);
	border: 1px solid var(--rw-border-subtle);
	font-size: 0.72rem;
}

/* ── нет доступа ── */
.ref-wheel-access {
	text-align: center;
	padding: 28px 20px;
	border-radius: var(--rw-radius);
	background: var(--rw-surface);
	border: 1px solid var(--rw-border-subtle);
}

.ref-wheel-access__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-bottom: 10px;
	border-radius: 12px;
	color: var(--rw-muted);
	background: var(--base-alfa-neutral, rgba(221, 221, 232, 0.07));
}

.ref-wheel-access h2 {
	margin: 0 0 6px;
	font-size: 1.05rem;
	font-weight: 800;
	color: #fff;
}

.ref-wheel-access p {
	margin: 0 0 14px;
	color: var(--rw-muted);
	font-size: 0.82rem;
	line-height: 1.5;
}

/* ── сетка ── */
.ref-wheel-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--rw-gap);
	margin-bottom: var(--rw-gap);
}

@media (max-width: 760px) {
	.ref-wheel-grid {
		grid-template-columns: 1fr;
	}

	.ref-wheel-head__row {
		flex-direction: column;
	}

	.ref-wheel-head .ref-wheel-limit {
		max-width: none;
		width: 100%;
	}
}

.ref-wheel-card {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 12px;
	border-radius: var(--rw-radius);
	background: var(--rw-surface);
	border: 1px solid var(--rw-border-subtle);
}

.ref-wheel-card__head {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 10px;
}

.ref-wheel-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 9px;
	flex-shrink: 0;
	color: #c8ccd4;
	background: var(--base-alfa-neutral, rgba(221, 221, 232, 0.07));
}

.ref-wheel-card__title {
	margin: 0;
	font-size: 0.88rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	color: #fff;
}

.ref-wheel-card__hint {
	margin: 2px 0 0;
	font-size: 0.7rem;
	line-height: 1.35;
	color: var(--rw-muted);
}

/* ── поля ── */
.ref-wheel-field {
	margin-bottom: 8px;
}

.ref-wheel-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

@media (max-width: 480px) {
	.ref-wheel-field-row {
		grid-template-columns: 1fr;
	}
}

.ref-wheel-field label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.65rem;
	font-weight: 650;
	color: var(--rw-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.ref-wheel-input {
	width: 100%;
	min-height: 36px;
	padding: 7px 10px;
	border-radius: var(--rw-radius-sm);
	border: 1px solid var(--rw-border);
	background: var(--rw-surface-2);
	color: var(--rw-text);
	font: inherit;
	font-size: 0.82rem;
	transition: border-color 0.15s, box-shadow 0.15s;
	box-sizing: border-box;
}

.ref-wheel-input:focus {
	outline: none;
	border-color: rgba(255, 255, 255, 0.18);
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.ref-wheel-input option {
	background: #1a1b1e;
	color: var(--rw-text);
}

.ref-wheel-field__note {
	margin: 0 0 8px;
	font-size: 0.7rem;
	line-height: 1.35;
	color: var(--rw-muted);
}

.ref-wheel-field__note.is-error {
	color: #f87171;
}

/* ── приз ── */
.ref-wheel-prize-types {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	margin-bottom: 10px;
	padding: 3px;
	border-radius: 10px;
	background: var(--rw-surface-2);
	border: 1px solid var(--rw-border-subtle);
}

.ref-wheel-prize-type {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.ref-wheel-prize-type input {
	display: none;
}

.ref-wheel-prize-type span {
	font-size: 0.8rem;
	font-weight: 700;
	color: #fff;
}

.ref-wheel-prize-type small {
	font-size: 0.68rem;
	color: var(--rw-muted);
	line-height: 1.3;
}

.ref-wheel-prize-type:has(input:checked) {
	background: var(--rw-elev);
	border-color: rgba(255, 255, 255, 0.12);
}

.ref-wheel-prize-type:has(input:checked) span {
	color: var(--rw-brand);
}

/* ── слот-пикер ── */
.ref-wheel-slot-picker {
	position: relative;
}

.ref-wheel-slot-list {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 4px);
	z-index: 30;
	max-height: 200px;
	overflow-y: auto;
	border-radius: var(--rw-radius-sm);
	border: 1px solid var(--rw-border);
	background: var(--rw-elev);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
	scrollbar-width: none;
}

.ref-wheel-slot-list::-webkit-scrollbar {
	display: none;
}

.ref-wheel-slot-list.is-hidden {
	display: none;
}

.ref-wheel-slot-list__item,
.ref-wheel-slot-list__empty {
	display: block;
	width: 100%;
	padding: 8px 10px;
	border: 0;
	background: transparent;
	color: var(--rw-text);
	text-align: left;
	font: inherit;
	font-size: 0.8rem;
	cursor: pointer;
}

.ref-wheel-slot-list__item:hover,
.ref-wheel-slot-list__item.is-active {
	background: var(--base-alfa-neutral, rgba(221, 221, 232, 0.1));
}

.ref-wheel-slot-list__empty {
	cursor: default;
	color: var(--rw-muted);
}

/* ── пул ── */
.ref-wheel-pool-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: auto;
	padding: 8px 10px;
	border-radius: var(--rw-radius-sm);
	background: var(--rw-surface-2);
	border: 1px solid var(--rw-border-subtle);
}

.ref-wheel-pool-info__copy {
	display: flex;
	align-items: baseline;
	gap: 6px;
	font-size: 0.75rem;
	color: var(--rw-muted);
}

.ref-wheel-pool-info__copy strong {
	font-size: 0.95rem;
	font-weight: 800;
	color: #fff;
}

/* ── ленты (1..5) ── */
.ref-wheel-cases {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0 0 var(--rw-gap);
}

.ref-wheel-case {
	position: relative;
	padding: 10px 0 8px;
	border-radius: var(--rw-radius);
	background: var(--rw-surface-2);
	border: 1px solid var(--rw-border-subtle);
	overflow: hidden;
}

.ref-wheel-case__label {
	position: relative;
	z-index: 3;
	margin: 0 12px 4px;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--rw-muted);
}

.ref-wheel-case::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
	background-size: 24px 24px;
	opacity: 0.5;
	pointer-events: none;
	mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

.ref-wheel-case::after {
	content: '';
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		linear-gradient(90deg, var(--rw-surface-2) 0%, transparent 12%),
		linear-gradient(270deg, var(--rw-surface-2) 0%, transparent 12%);
	z-index: 2;
}

.ref-wheel-case__pointer {
	position: absolute;
	top: 6px;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	width: 2px;
	background: linear-gradient(180deg, transparent, var(--rw-brand), transparent);
	z-index: 4;
}

.ref-wheel-case__pointer::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--rw-brand);
}

.ref-wheel-case__pointer::after {
	content: '';
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 8px solid var(--rw-brand);
}

.ref-wheel-case__viewport {
	position: relative;
	overflow: hidden;
	height: 104px;
	z-index: 1;
}

.ref-wheel-case__track {
	display: flex;
	gap: 8px;
	will-change: transform;
	transition: transform 0s;
}

.ref-wheel-case__track.is-preview {
	padding: 8px;
	width: max-content;
	min-width: 100%;
	box-sizing: border-box;
}

.ref-wheel-case__track.is-spin {
	padding: 8px 50%;
}

.ref-wheel-case__item {
	flex: 0 0 88px;
	height: 88px;
	border-radius: 10px;
	background: var(--rw-elev);
	border: 1px solid var(--rw-border);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	text-align: center;
	padding: 6px;
	transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.ref-wheel-case__item img {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: #2a2b2f;
}

.ref-wheel-case__item strong {
	font-size: 0.64rem;
	line-height: 1.2;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 700;
	color: #fff;
}

.ref-wheel-case__item small {
	font-size: 0.58rem;
	color: var(--rw-muted);
}

.ref-wheel-case__item--winner {
	border-color: var(--rw-brand-line);
	box-shadow: 0 0 0 1px rgba(0, 179, 82, 0.12);
	transform: scale(1.04);
}

/* ── действия ── */
.ref-wheel-actions {
	display: flex;
	justify-content: center;
	padding: 0;
}

.ref-wheel-limit {
	display: flex;
	align-items: center;
	gap: 7px;
	color: var(--rw-muted);
	line-height: 1.35;
}

.ref-wheel-limit__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	flex-shrink: 0;
	background: var(--rw-brand);
}

.ref-wheel-limit.is-waiting .ref-wheel-limit__dot {
	background: #e7a32c;
}

/* ── кнопки ── */
.ref-wheel-btn {
	border: 0;
	border-radius: 10px;
	padding: 8px 14px;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.12s, background 0.15s, border-color 0.15s, opacity 0.15s;
}

.ref-wheel-btn:active {
	transform: scale(0.98);
}

.ref-wheel-btn:disabled {
	opacity: 0.42;
	cursor: not-allowed;
}

.ref-wheel-btn--primary {
	background: var(--rw-brand);
	color: #0a0a0a;
}

.ref-wheel-btn--primary:hover:not(:disabled) {
	filter: brightness(1.05);
}

.ref-wheel-btn--ghost {
	background: var(--rw-surface-2);
	color: var(--rw-text);
	border: 1px solid var(--rw-border);
}

.ref-wheel-btn--ghost:hover:not(:disabled) {
	border-color: rgba(255, 255, 255, 0.16);
	background: var(--base-alfa-neutral, rgba(221, 221, 232, 0.08));
}

.ref-wheel-btn--sm {
	padding: 6px 10px;
	font-size: 0.72rem;
	border-radius: 8px;
}

.ref-wheel-btn--lg {
	padding: 11px 28px;
	font-size: 0.88rem;
	min-width: 180px;
}

.ref-wheel-card .ref-wheel-btn--ghost {
	margin-top: 2px;
	align-self: flex-start;
}

/* ── результат ── */
.ref-wheel-result {
	margin-top: var(--rw-gap);
	padding: 12px 14px;
	border-radius: var(--rw-radius);
	background: var(--rw-surface);
	border: 1px solid var(--rw-border);
}

.ref-wheel-result__winner {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 6px;
}

.ref-wheel-result__person {
	display: flex;
	align-items: center;
	gap: 10px;
}

.ref-wheel-result__winner img,
.ref-wheel-result__person img {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--rw-border);
	flex-shrink: 0;
}

.ref-wheel-result__prize {
	color: var(--rw-brand);
	font-weight: 700;
	font-size: 0.82rem;
}

.is-hidden {
	display: none !important;
}

@media (max-width: 640px) {
	.ref-wheel-actions {
		align-items: stretch;
	}

	.ref-wheel-btn--lg {
		width: 100%;
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ref-wheel-case__item,
	.ref-wheel-btn {
		transition: none;
	}
}
