/* ── Reset & base ── */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family:
		system-ui,
		-apple-system,
		sans-serif;
	background: #0f0f13;
	color: #e8e8f0;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ── Card ── */
.card {
	background: #1a1a24;
	border: 1px solid #2a2a38;
	border-radius: 12px;
	padding: 2rem;
	width: 100%;
	max-width: 420px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.card h1 {
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 0.25rem;
	color: #fff;
}
.card .subtitle {
	font-size: 0.875rem;
	color: #888;
	margin-bottom: 1.75rem;
}

/* ── Tabs ── */
.tabs {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}
.tab-btn {
	flex: 1;
	padding: 0.5rem;
	border: 1px solid #2a2a38;
	border-radius: 8px;
	background: transparent;
	color: #888;
	cursor: pointer;
	font-size: 0.875rem;
	transition: all 0.15s;
}
.tab-btn.active {
	background: #7c3aed;
	border-color: #7c3aed;
	color: #fff;
	font-weight: 600;
}

/* ── Form ── */
.form-group {
	margin-bottom: 1rem;
}
label {
	display: block;
	font-size: 0.8rem;
	color: #aaa;
	margin-bottom: 0.35rem;
	font-weight: 500;
}
input[type="email"],
input[type="password"],
input[type="text"] {
	width: 100%;
	padding: 0.65rem 0.85rem;
	background: #0f0f13;
	border: 1px solid #2a2a38;
	border-radius: 8px;
	color: #e8e8f0;
	font-size: 0.9rem;
	outline: none;
	transition: border-color 0.15s;
}
select {
	width: 100%;
	padding: 0.65rem 0.85rem;
	background: #0f0f13;
	border: 1px solid #2a2a38;
	border-radius: 8px;
	color: #e8e8f0;
	font-size: 0.9rem;
	outline: none;
	transition: border-color 0.15s;
}
input:focus {
	border-color: #7c3aed;
}
select:focus {
	border-color: #7c3aed;
}

/* ── Buttons ── */
.btn {
	width: 100%;
	padding: 0.7rem;
	border: none;
	border-radius: 8px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition:
		opacity 0.15s,
		transform 0.1s;
}
.btn:active {
	transform: scale(0.98);
}
.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.btn-primary {
	background: #7c3aed;
	color: #fff;
}
.btn-primary:hover:not(:disabled) {
	background: #6d28d9;
}

.btn-outline {
	background: transparent;
	border: 1px solid #2a2a38;
	color: #aaa;
	margin-top: 0.5rem;
}
.btn-outline:hover:not(:disabled) {
	border-color: #7c3aed;
	color: #fff;
}

.btn-small {
	width: auto;
	padding: 0.58rem 0.8rem;
	font-size: 0.78rem;
	margin-top: 0;
	flex-shrink: 0;
}

.nickname-row {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.nickname-inline-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.nickname-inline {
	flex: 1;
	display: flex;
	align-items: center;
	border: 1px solid #2a2a38;
	border-radius: 8px;
	overflow: hidden;
	background: #0f0f13;
}

.nickname-segment {
	border: 0;
	border-radius: 0;
	background: transparent;
	padding: 0.6rem 0.65rem;
	min-width: 0;
}

.nickname-segment:focus {
	outline: none;
	border: 0;
}

.nickname-suffix-box {
	padding: 0.6rem 0;
	border-left: 1px solid #2a2a38;
	background: #111122;
	font-family: monospace;
	font-size: 0.88rem;
	color: #cfcfe8;
	letter-spacing: 0.08em;
	width: 4.8ch;
	text-align: center;
}

.nickname-refresh-inline {
	margin-top: 0;
	white-space: nowrap;
}

.nickname-meta {
	margin-top: 0.4rem;
	font-size: 0.76rem;
	color: #aaa;
	min-height: 1rem;
}

.nickname-meta.ok {
	color: #6ee7b7;
}

.nickname-meta.error {
	color: #fca5a5;
}

.nickname-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin-top: 0.35rem;
}

.nickname-chip {
	border: 1px solid #3b3b4f;
	background: #14141d;
	color: #cfcfe8;
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
	font-size: 0.72rem;
	cursor: pointer;
}

.nickname-chip:hover {
	border-color: #7c3aed;
	color: #fff;
}

/* ── Alerts ── */
.alert {
	padding: 0.65rem 0.85rem;
	border-radius: 8px;
	font-size: 0.85rem;
	margin-bottom: 1rem;
	display: none;
}
.alert.show {
	display: block;
}
.alert-error {
	background: #3b1f1f;
	border: 1px solid #7f3030;
	color: #fca5a5;
}
.alert-success {
	background: #1a3b2a;
	border: 1px solid #2d7a4f;
	color: #6ee7b7;
}
.alert-info {
	background: #1e2a3b;
	border: 1px solid #2d4f7a;
	color: #93c5fd;
}

/* ── Status badge (logged-in view) ── */
.user-badge {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	background: #0f0f13;
	border: 1px solid #2a2a38;
	border-radius: 10px;
	padding: 0.75rem 1rem;
	margin-bottom: 1.25rem;
}
.avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #7c3aed;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 1.1rem;
	color: #fff;
	flex-shrink: 0;
}
.user-info .uid {
	font-size: 0.72rem;
	color: #555;
	font-family: monospace;
	margin-top: 0.1rem;
}

/* ── MFA section ── */
.mfa-section {
	border-top: 1px solid #2a2a38;
	margin-top: 1.25rem;
	padding-top: 1.25rem;
}
.mfa-section h3 {
	font-size: 0.95rem;
	margin-bottom: 0.5rem;
}

/* ── Divider ── */
.divider {
	text-align: center;
	color: #444;
	font-size: 0.8rem;
	margin: 1rem 0;
	position: relative;
}
.divider::before,
.divider::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 42%;
	height: 1px;
	background: #2a2a38;
}
.divider::before {
	left: 0;
}
.divider::after {
	right: 0;
}

/* ── Token preview ── */
.token-box {
	background: #0f0f13;
	border: 1px solid #2a2a38;
	border-radius: 8px;
	padding: 0.6rem 0.85rem;
	font-family: monospace;
	font-size: 0.7rem;
	color: #6ee7b7;
	word-break: break-all;
	max-height: 60px;
	overflow: hidden;
	position: relative;
	margin-top: 0.5rem;
	cursor: pointer;
}
.token-box::after {
	content: "click to copy";
	position: absolute;
	bottom: 4px;
	right: 8px;
	font-size: 0.65rem;
	color: #555;
}

.hidden {
	display: none !important;
}

/* ── Emulator banner ── */
.emulator-banner {
	background: #2a1f0a;
	border: 1px solid #7a5f1a;
	color: #fcd34d;
	padding: 0.5rem 0.85rem;
	border-radius: 8px;
	font-size: 0.78rem;
	margin-bottom: 1.25rem;
	text-align: center;
}
