/* Gatekeeper UI */
:root {
	--nexus-bg: #0c1016;
	--nexus-panel: rgba(18, 23, 32, 0.78);
	--nexus-panel-strong: rgba(18, 23, 32, 0.9);
	--nexus-accent: #4ed0ff;
	--nexus-accent-2: #6f5bff;
	--nexus-text: #e6edf7;
	--nexus-muted: #9aa5b5;
	--nexus-danger: #ff7b7b;
	--nexus-success: #22e19f;
	--nexus-border: rgba(255, 255, 255, 0.08);
	--nexus-radius: 18px;
	--nexus-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
	--nexus-glow: 0 0 0 1px rgba(78, 208, 255, 0.14), 0 0 30px rgba(111, 91, 255, 0.15);
	font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

.nexus-gatekeeper-shell {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 24px;
	background: radial-gradient(circle at 20% 20%, rgba(78, 208, 255, 0.08), transparent 35%),
		radial-gradient(circle at 80% 10%, rgba(111, 91, 255, 0.1), transparent 40%),
		radial-gradient(circle at 50% 90%, rgba(78, 208, 255, 0.05), transparent 45%);
	padding: 24px;
	border-radius: 24px;
	box-shadow: var(--nexus-shadow);
	border: 1px solid var(--nexus-border);
	color: var(--nexus-text);
	background-color: var(--nexus-bg);
}

.nexus-gatekeeper-panel {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
	border: 1px solid var(--nexus-border);
	border-radius: var(--nexus-radius);
	box-shadow: var(--nexus-glow);
	padding: 24px;
	position: relative;
	overflow: hidden;
}

.nexus-gatekeeper-guardian {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.nexus-gatekeeper-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}

.nexus-gatekeeper-pill {
	background: rgba(78, 208, 255, 0.14);
	border: 1px solid rgba(78, 208, 255, 0.4);
	color: var(--nexus-text);
	border-radius: 999px;
	padding: 8px 14px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.nexus-gatekeeper-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--nexus-success);
	box-shadow: 0 0 12px var(--nexus-success);
	display: inline-block;
}

.nexus-gatekeeper-language {
	color: var(--nexus-muted);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
}

.nexus-gatekeeper-language select {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--nexus-border);
	color: var(--nexus-text);
	border-radius: 999px;
	padding: 6px 10px;
}

.nexus-gatekeeper-guard-visual {
	position: relative;
	height: 360px;
	border-radius: 16px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.06);
	background:
		radial-gradient(circle at 50% 22%, rgba(178, 140, 255, 0.35), transparent 18%),
		radial-gradient(circle at 50% 42%, rgba(78, 208, 255, 0.22), transparent 24%),
		linear-gradient(180deg, rgba(78, 208, 255, 0.16), rgba(12, 16, 22, 0.88));
	box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.55);
}

.nexus-gatekeeper-guard-overlay {
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 70% 20%, rgba(78, 208, 255, 0.2), transparent 40%);
	mix-blend-mode: screen;
}

.nexus-gatekeeper-alert {
	border-radius: var(--nexus-radius);
	padding: 14px;
	background: rgba(34, 225, 159, 0.06);
	border: 1px solid rgba(34, 225, 159, 0.35);
	color: var(--nexus-text);
	font-size: 0.95rem;
	line-height: 1.4;
}

.nexus-gatekeeper-alert strong {
	display: block;
	margin-bottom: 4px;
}

.nexus-gatekeeper-login .nexus-gatekeeper-brand {
	margin-bottom: 16px;
}

.nexus-gatekeeper-logo {
	font-size: 1.8rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	color: #b28cff;
}

.nexus-gatekeeper-logo span {
	color: var(--nexus-accent);
}

.nexus-gatekeeper-brand p {
	margin: 4px 0 0;
	color: var(--nexus-muted);
}

.nexus-gatekeeper-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.nexus-gatekeeper-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.nexus-gatekeeper-field label {
	font-weight: 600;
	color: var(--nexus-muted);
}

.nexus-gatekeeper-field input,
.nexus-gatekeeper-field select {
	background: var(--nexus-panel-strong);
	border: 1px solid var(--nexus-border);
	border-radius: 12px;
	padding: 12px 14px;
	color: var(--nexus-text);
	font-size: 1rem;
	transition: border 0.2s ease, box-shadow 0.2s ease;
}

.nexus-gatekeeper-field input:focus {
	outline: none;
	border-color: rgba(78, 208, 255, 0.6);
	box-shadow: 0 0 0 2px rgba(78, 208, 255, 0.2);
}

.nexus-gatekeeper-passcode-wrap {
	display: flex;
	align-items: center;
	background: var(--nexus-panel-strong);
	border: 1px solid var(--nexus-border);
	border-radius: 12px;
	overflow: hidden;
}

.nexus-gatekeeper-passcode-wrap input {
	border: none;
	flex: 1;
	padding: 12px 14px;
}

.nexus-gatekeeper-passcode-wrap input:focus {
	box-shadow: none;
}

.nexus-gatekeeper-eye {
	width: 38px;
	height: 100%;
	background: linear-gradient(135deg, rgba(78, 208, 255, 0.15), rgba(111, 91, 255, 0.15));
}

.nexus-gatekeeper-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
}

.nexus-gatekeeper-destination-note {
	border: 1px solid var(--nexus-border);
	border-radius: 12px;
	padding: 12px 14px;
	background: rgba(78, 208, 255, 0.06);
	color: var(--nexus-muted);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.nexus-gatekeeper-destination-note strong {
	color: var(--nexus-text);
}

.nexus-gatekeeper-cta {
	margin-top: 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nexus-gatekeeper-remember {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--nexus-muted);
	font-size: 0.95rem;
}

.nexus-gatekeeper-remember input {
	accent-color: var(--nexus-accent);
}

.nexus-gatekeeper-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 14px 18px;
	border-radius: 12px;
	border: 0;
	cursor: pointer;
	color: #fff;
	font-weight: 700;
	letter-spacing: 0.01em;
	background: linear-gradient(135deg, #2b6cff, #37d0ff);
	box-shadow: 0 12px 24px rgba(55, 208, 255, 0.3);
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.nexus-gatekeeper-button:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 30px rgba(55, 208, 255, 0.4);
}

.nexus-gatekeeper-button.ghost {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.16);
	box-shadow: none;
}

.nexus-gatekeeper-links {
	display: flex;
	justify-content: space-between;
	font-size: 0.95rem;
}

.nexus-gatekeeper-links a,
.nexus-gatekeeper-link {
	color: var(--nexus-accent);
	text-decoration: none;
}

.nexus-gatekeeper-links a:hover,
.nexus-gatekeeper-link:hover {
	text-decoration: underline;
}

.nexus-gatekeeper-footer {
	display: flex;
	align-items: center;
	gap: 12px;
	color: var(--nexus-muted);
	font-size: 0.95rem;
}

.nexus-gatekeeper-version {
	margin-left: auto;
	color: rgba(255, 255, 255, 0.5);
}

.nexus-gatekeeper-notice {
	border-radius: 12px;
	padding: 12px 14px;
	border: 1px solid var(--nexus-border);
}

.nexus-gatekeeper-notice.error {
	border-color: rgba(255, 123, 123, 0.4);
	background: rgba(255, 123, 123, 0.08);
	color: #ffd0d0;
}

.nexus-gatekeeper-notice.success {
	border-color: rgba(34, 225, 159, 0.5);
	background: rgba(34, 225, 159, 0.08);
	color: #c8f7e9;
}

.nexus-gatekeeper-dock {
	background: var(--nexus-panel);
	padding: 24px;
	border-radius: var(--nexus-radius);
	border: 1px solid var(--nexus-border);
	box-shadow: var(--nexus-shadow);
	color: var(--nexus-text);
}

.nexus-gatekeeper-dock-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	gap: 12px;
}

.nexus-gatekeeper-dock h2 {
	margin: 0;
}

.nexus-gatekeeper-grid-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 14px;
}

.nexus-gatekeeper-tile {
	padding: 16px;
	border-radius: 14px;
	border: 1px solid var(--nexus-border);
	background: linear-gradient(140deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nexus-gatekeeper-tile.empty {
	border-color: rgba(255, 255, 255, 0.08);
	color: var(--nexus-muted);
}

.nexus-gatekeeper-dock .nexus-gatekeeper-button {
	padding: 10px 14px;
}

@media (max-width: 900px) {
	.nexus-gatekeeper-shell {
		grid-template-columns: 1fr;
	}

	.nexus-gatekeeper-links {
		flex-direction: column;
		gap: 6px;
	}
}


/* Public modal bridge. The NavatarCity runtime continues to own the dialog,
 * overlay, close control, dismissal, body lock, and focus restoration. */
.nexus-gatekeeper-modal-root {
	--gk-accent: #c86bff;
	--gk-blue: #4baeff;
	--gk-text: #f4f7fc;
	--gk-muted: #aeb8ca;
	display: grid;
	grid-template-columns: minmax(300px, 0.92fr) minmax(360px, 1.08fr);
	min-height: min(680px, calc(90vh - 20px));
	overflow: hidden;
	border-radius: 14px;
	color: var(--gk-text);
	background: linear-gradient(145deg, #06162b, #020811 68%);
	font-family: "Segoe UI", Arial, sans-serif;
}

.nexus-gatekeeper-modal-root * { box-sizing: border-box; }
.nexus-gatekeeper-modal-root[hidden] { display: none !important; }

.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-presentation {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-width: 0;
	padding: 28px;
	background: radial-gradient(circle at 50% 25%, rgba(91, 55, 170, .3), transparent 48%), #030a15;
	border-right: 1px solid rgba(75, 174, 255, .18);
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-avatar-frame {
	position: relative;
	min-height: 470px;
	overflow: hidden;
	border: 1px solid rgba(200, 107, 255, .28);
	border-radius: 16px;
	background: #020610;
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-avatar {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	min-height: 470px;
	background:
		radial-gradient(circle at 50% 28%, rgba(210, 105, 255, .3), transparent 34%),
		linear-gradient(145deg, rgba(43, 16, 75, .96), rgba(10, 12, 28, .98));
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-avatar-emblem {
	display: grid;
	place-items: center;
	width: 112px;
	height: 112px;
	border: 2px solid rgba(229, 167, 255, .75);
	border-radius: 50%;
	background: linear-gradient(145deg, #9b32d4, #3b1264);
	color: #fff;
	font-size: 3rem;
	font-weight: 800;
	line-height: 1;
	box-shadow: 0 0 42px rgba(183, 67, 234, .48);
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-avatar-subtitle {
	position: absolute;
	left: 18px;
	right: 18px;
	bottom: 18px;
	padding: 11px 14px;
	border: 1px solid rgba(200, 107, 255, .3);
	border-radius: 10px;
	background: rgba(2, 8, 18, .82);
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-questions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-top: 18px;
	padding: 12px 15px;
	border: 1px solid rgba(200, 107, 255, .24);
	border-radius: 12px;
	background: rgba(255, 255, 255, .035);
	color: var(--gk-muted);
	cursor: not-allowed;
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-questions small { font-size: 11px; }

.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-auth {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	padding: clamp(32px, 5vw, 70px);
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-kicker {
	color: #fff;
	font-size: 24px;
	font-weight: 800;
	letter-spacing: .06em;
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-kicker span { color: var(--gk-accent); }
.nexus-gatekeeper-modal-root h2 { margin: 18px 0 10px; color: #fff; font-size: clamp(28px, 3vw, 42px); }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-brand p { margin: 0 0 28px; color: var(--gk-muted); line-height: 1.6; }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-form { display: grid; gap: 10px; }
.nexus-gatekeeper-modal-root label { color: #eaf0fa; font-size: 13px; font-weight: 650; }

.nexus-gatekeeper-modal-root input {
	width: 100%;
	height: 48px;
	margin: 0 0 10px;
	padding: 0 14px;
	border: 1px solid rgba(132, 158, 198, .34);
	border-radius: 10px;
	outline: 0;
	background: #07101f !important;
	color: #f7f9ff !important;
	-webkit-text-fill-color: #f7f9ff;
	caret-color: #fff;
	font: inherit;
}

.nexus-gatekeeper-modal-root input::placeholder {
	color: #aebbd0 !important;
	-webkit-text-fill-color: #aebbd0;
	opacity: 1;
}

.nexus-gatekeeper-modal-root input::selection {
	background: #8a25c7;
	color: #fff;
	-webkit-text-fill-color: #fff;
}

.nexus-gatekeeper-modal-root input:focus {
	border-color: var(--gk-accent);
	background: #09162a !important;
	color: #fff !important;
	-webkit-text-fill-color: #fff;
	box-shadow: 0 0 0 3px rgba(200, 107, 255, .2);
}
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-otp[hidden],
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-resend[hidden] { display: none; }

.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-primary,
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-resend {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 0 18px;
	border-radius: 10px;
	font: 700 14px/1 "Segoe UI", Arial, sans-serif;
	text-decoration: none;
	cursor: pointer;
}

.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-primary { border: 1px solid #d68dff; background: linear-gradient(135deg, #8a25c7, #4f168c); color: #fff; }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-resend { border: 1px solid rgba(200, 107, 255, .32); background: transparent; color: #dcb5f5; }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-status { min-height: 22px; margin-bottom: 14px; color: var(--gk-muted); font-size: 13px; line-height: 1.45; }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-status.is-error { color: #ff9fa8; }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-status.is-success { color: #8ee6b2; }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-message-bank {
	position: absolute !important;
	left: -20000px !important;
	top: 0 !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	pointer-events: none !important;
}
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-support { display: grid; gap: 4px; margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .08); color: var(--gk-muted); font-size: 12px; }
.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-support strong { color: #eaf0fa; }
.nexus-gatekeeper-modal-root.is-busy { cursor: progress; }
.nexus-gatekeeper-modal-root.is-busy button { opacity: .62; }

@media (max-width: 760px) {
	.nexus-gatekeeper-modal-root { grid-template-columns: 1fr; max-height: calc(90vh - 12px); overflow: auto; }
	.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-presentation { padding: 14px; border-right: 0; border-bottom: 1px solid rgba(75, 174, 255, .18); }
	.nexus-gatekeeper-modal-root .nexus-gatekeeper-avatar-frame,
	.nexus-gatekeeper-modal-root .nexus-gatekeeper-avatar { min-height: 220px; max-height: 260px; }
	.nexus-gatekeeper-modal-root .nexus-gatekeeper-questions { margin-top: 10px; }
	.nexus-gatekeeper-modal-root .nexus-gatekeeper-modal-auth { padding: 28px 20px 58px; }
}

#nexus-gatekeeper-modal-staging {
	position: absolute !important;
	left: -30000px !important;
	top: 0 !important;
	width: 1120px !important;
	height: auto !important;
	overflow: visible !important;
	pointer-events: none !important;
	z-index: -1 !important;
}

@media (prefers-reduced-motion: reduce) {
	.nexus-gatekeeper-modal-root *, .nexus-gatekeeper-modal-root *::before, .nexus-gatekeeper-modal-root *::after { scroll-behavior: auto !important; transition-duration: 1ms !important; }
}
