/* Login / Sign Up modal — purple glass */
.auth-root[hidden] {
	display: none !important;
}

.auth-root.is-open {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	overflow: hidden;
}

.auth-overlay {
	position: absolute;
	inset: 0;
	background: rgba(3, 3, 8, 0.72);
	backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.auth-root.is-open .auth-overlay {
	opacity: 1;
}

.auth-modal {
	position: relative;
	width: min(100%, 400px);
	max-height: min(90vh, 700px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 20px;
	border: 1px solid rgba(192, 38, 255, 0.55);
	background-color: rgba(10, 6, 24, 0.94);
	background-image:
		linear-gradient(rgba(147, 51, 255, 0.07) 1px, transparent 1px),
		linear-gradient(90deg, rgba(147, 51, 255, 0.07) 1px, transparent 1px),
		radial-gradient(ellipse 90% 55% at 50% 0%, rgba(192, 38, 255, 0.22), transparent 58%);
	background-size: 16px 16px, 16px 16px, auto;
	box-shadow:
		0 0 0 1px rgba(107, 33, 255, 0.4),
		0 0 36px rgba(192, 38, 255, 0.45),
		0 12px 40px rgba(3, 3, 8, 0.65);
	transform: scale(0.94) translateY(12px);
	opacity: 0;
	transition: transform 0.28s ease, opacity 0.28s ease;
}

.auth-root.is-open.is-visible .auth-modal {
	transform: scale(1) translateY(0);
	opacity: 1;
}

.auth-root.is-closing .auth-modal {
	transform: scale(0.96) translateY(8px);
	opacity: 0;
}

.auth-modal__close {
	position: absolute;
	top: 0.55rem;
	right: 0.55rem;
	z-index: 3;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid rgba(192, 38, 255, 0.65);
	background: rgba(20, 10, 42, 0.95);
	color: var(--hwan-purple-bright);
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 0 14px rgba(192, 38, 255, 0.35);
}

.auth-modal__inner {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	max-height: min(90vh, 700px);
	overflow: hidden;
}

.auth-modal__head {
	flex-shrink: 0;
	padding: 1.25rem 1.1rem 0.65rem;
	padding-right: 2.75rem;
	text-align: center;
}

.auth-modal__scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	scrollbar-width: thin;
	scrollbar-color: rgba(192, 38, 255, 0.65) transparent;
}

.auth-modal__scroll::-webkit-scrollbar {
	width: 7px;
}

.auth-modal__scroll::-webkit-scrollbar-track {
	background: transparent;
}

.auth-modal__scroll::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, rgba(224, 64, 251, 0.75), rgba(107, 33, 255, 0.75));
	border-radius: 999px;
	border: 2px solid rgba(10, 6, 24, 0.9);
}

.auth-modal__scroll-pad {
	padding: 0 1.1rem 1.15rem;
	max-width: 100%;
	box-sizing: border-box;
}

.auth-modal__badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin: 0 auto 0.45rem;
	padding: 0.35rem 0.85rem;
	border-radius: 999px;
	border: 1px solid rgba(192, 38, 255, 0.6);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--hwan-purple-bright);
	box-shadow: 0 0 16px rgba(192, 38, 255, 0.3);
}

.auth-modal__lead {
	margin: 0 0 0.85rem;
	font-size: 0.86rem;
	color: var(--hwan-muted);
	line-height: 1.45;
}

.auth-tabs {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 0.35rem;
	padding: 0.35rem;
	border-radius: 999px;
	background: rgba(8, 5, 18, 0.75);
	border: 1px solid rgba(192, 38, 255, 0.35);
}

.auth-tabs__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	min-width: 0;
	padding: 0.55rem 0.4rem;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: rgba(248, 246, 255, 0.5);
	font-weight: 700;
	font-size: 0.78rem;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.auth-tabs__btn.is-active {
	color: var(--hwan-white);
	background: linear-gradient(135deg, rgba(107, 33, 255, 0.98), rgba(224, 64, 251, 0.92));
	box-shadow: 0 0 18px rgba(192, 38, 255, 0.45);
}

.auth-tabs__icon {
	width: 17px;
	height: 17px;
	flex-shrink: 0;
}

.auth-panels {
	position: relative;
	width: 100%;
	max-width: 100%;
}

.auth-panel {
	display: none;
	flex-direction: column;
	gap: 0.7rem;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.auth-panel.is-active {
	display: flex;
}

.auth-panel__promo {
	margin: 0 0 0.15rem;
	text-align: center;
	font-size: 0.84rem;
	color: var(--hwan-muted);
}

.auth-panel__promo strong {
	color: var(--hwan-purple-bright);
}

.auth-field {
	display: flex;
	flex-direction: column;
	gap: 0.32rem;
	min-width: 0;
	width: 100%;
}

.auth-field__label {
	font-size: 0.76rem;
	color: rgba(248, 246, 255, 0.62);
}

.auth-field__control {
	display: flex;
	align-items: center;
	min-width: 0;
	width: 100%;
	border-radius: 12px;
	border: 1px solid rgba(147, 51, 255, 0.4);
	background: rgba(3, 3, 8, 0.55);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field__control:focus-within {
	border-color: rgba(224, 64, 251, 0.75);
	box-shadow: 0 0 0 2px rgba(192, 38, 255, 0.2), 0 0 16px rgba(192, 38, 255, 0.25);
}

.auth-field__icon {
	display: grid;
	place-items: center;
	width: 40px;
	flex-shrink: 0;
	color: var(--hwan-purple-bright);
}

.auth-field__icon svg {
	width: 19px;
	height: 19px;
}

.auth-field__input {
	flex: 1;
	min-width: 0;
	width: 100%;
	padding: 0.68rem 0.65rem 0.68rem 0;
	border: none;
	background: transparent;
	color: var(--hwan-white);
	font-size: 0.9rem;
	font-family: inherit;
	outline: none;
}

.auth-field__input::placeholder {
	color: rgba(210, 200, 230, 0.38);
}

.auth-field__select {
	appearance: none;
	cursor: pointer;
	padding-right: 2rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23e040fb' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
}

.auth-field__eye {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border: none;
	background: transparent;
	color: var(--hwan-muted);
	cursor: pointer;
}

.auth-field__eye svg {
	width: 19px;
	height: 19px;
}

.auth-field-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 0.55rem;
	min-width: 0;
	width: 100%;
}

.auth-field-row .auth-field {
	min-width: 0;
}

.auth-pass-rules {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 0.32rem 0.5rem;
	margin: -0.15rem 0 0.15rem;
	padding: 0;
	list-style: none;
	font-size: 0.68rem;
	color: rgba(248, 246, 255, 0.42);
}

.auth-pass-rules li {
	display: flex;
	align-items: center;
	gap: 0.32rem;
	min-width: 0;
}

.auth-pass-rules__dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	border: 1px solid rgba(192, 38, 255, 0.5);
	flex-shrink: 0;
}

.auth-pass-rules li.is-ok {
	color: var(--hwan-purple-bright);
}

.auth-pass-rules li.is-ok .auth-pass-rules__dot {
	background: var(--hwan-purple-mid);
	border-color: var(--hwan-purple-bright);
	box-shadow: 0 0 8px rgba(192, 38, 255, 0.55);
}

.auth-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	width: 100%;
	max-width: 100%;
	margin-top: 0.25rem;
	padding: 0.82rem 1rem;
	border: none;
	border-radius: 14px;
	font-weight: 700;
	font-size: 0.92rem;
	cursor: pointer;
	color: var(--hwan-white);
	background: linear-gradient(135deg, rgba(107, 33, 255, 0.98), rgba(224, 64, 251, 0.9));
	box-shadow: 0 0 22px rgba(192, 38, 255, 0.4);
}

.auth-submit__icon {
	width: 19px;
	height: 19px;
	flex-shrink: 0;
}

.auth-submit--signup {
	background: linear-gradient(135deg, rgba(93, 24, 220, 0.98), rgba(192, 38, 255, 0.92) 55%, rgba(224, 64, 251, 0.88));
}

.auth-trust {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.45rem 0.75rem;
	margin: 0.75rem 0 0;
	padding: 0.6rem 0 0;
	list-style: none;
	border-top: 1px solid rgba(192, 38, 255, 0.22);
	font-size: 0.66rem;
	color: rgba(248, 246, 255, 0.48);
}

.auth-trust li {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

body.auth-modal-open {
	overflow: hidden;
}

/* ESC confirm */
.auth-exit {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(3, 3, 8, 0.45);
	backdrop-filter: blur(4px);
}

.auth-exit[hidden] {
	display: none !important;
}

.auth-exit__card {
	width: min(100%, 340px);
	padding: 1.35rem 1.25rem 1.15rem;
	text-align: center;
	border-radius: 18px;
	border: 1px solid rgba(192, 38, 255, 0.55);
	background:
		linear-gradient(rgba(147, 51, 255, 0.06) 1px, transparent 1px),
		linear-gradient(90deg, rgba(147, 51, 255, 0.06) 1px, transparent 1px),
		rgba(12, 8, 28, 0.96);
	background-size: 16px 16px;
	box-shadow: var(--hwan-glow-purple);
	animation: auth-exit-in 0.22s ease;
}

@keyframes auth-exit-in {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.auth-exit__icon {
	width: 40px;
	height: 40px;
	margin: 0 auto 0.65rem;
	border-radius: 50%;
	border: 2px solid var(--hwan-purple-bright);
	color: var(--hwan-purple-bright);
	font-weight: 700;
	font-size: 1.25rem;
	line-height: 36px;
}

.auth-exit__title {
	margin: 0 0 0.5rem;
	font-size: 1.05rem;
	color: var(--hwan-white);
}

.auth-exit__text {
	margin: 0 0 1rem;
	font-size: 0.85rem;
	color: var(--hwan-muted);
	line-height: 1.45;
}

.auth-exit__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.65rem;
}

.auth-exit__btn {
	padding: 0.65rem 0.75rem;
	border-radius: 12px;
	font-weight: 700;
	font-size: 0.88rem;
	cursor: pointer;
	border: 1px solid transparent;
	font-family: inherit;
}

.auth-exit__btn--ghost {
	background: transparent;
	border-color: rgba(192, 38, 255, 0.5);
	color: var(--hwan-purple-bright);
}

.auth-exit__btn--primary {
	background: linear-gradient(135deg, rgba(107, 33, 255, 0.98), rgba(224, 64, 251, 0.9));
	color: var(--hwan-white);
	box-shadow: 0 0 16px rgba(192, 38, 255, 0.35);
}

.auth-root.mode-signup .auth-modal__badge {
	border-color: rgba(224, 64, 251, 0.7);
	color: var(--hwan-purple-bright);
}

@media (min-width: 480px) {
	.auth-modal {
		width: min(100%, 408px);
	}
}

@media (max-width: 400px) {
	.auth-field-row,
	.auth-pass-rules {
		grid-template-columns: 1fr;
	}

	.auth-modal__head {
		padding-right: 2.5rem;
	}
}
