:root {
	--wine: #72222a;
	--wine-dark: #3a0b0d;
	--gold: #d88b35;
	--vellum: #ffe9a9;
	--text: #faf9d9;
	--muted: #e4b279;
	--line: rgba(216, 139, 53, 0.36);
	--panel: rgba(18, 7, 5, 0.76);
	--panel-strong: rgba(6, 0, 0, 0.88);
	--card: rgba(0, 0, 0, 0.24);
	color-scheme: dark;
	font-family: Georgia, 'Times New Roman', serif;
	color: var(--text);
	background: #040101;
}

* {
	box-sizing: border-box;
}

html,
body {
	min-height: 100%;
}

body {
	margin: 0;
}

button,
input {
	font: inherit;
}

svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.login-shell {
	position: relative;
	z-index: 0;
	isolation: isolate;
	min-height: 100vh;
	min-height: 100svh;
	display: grid;
	place-items: center;
	padding: 24px;
	overflow: hidden;
	color: var(--text);
	background:
		radial-gradient(ellipse at 12% 105%, rgba(210, 82, 28, 0.56), transparent 55%),
		radial-gradient(circle at 76% 16%, rgba(216, 139, 53, 0.12), transparent 32%),
		linear-gradient(145deg, #2d140b, #160806 55%, #040101);
}

.login-shell::before {
	content: '';
	position: absolute;
	z-index: 3;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100svh;
	background-image: url('/oauth/assets/icon_hand.png');
	background-repeat: no-repeat;
	background-position: 2vw center;
	background-size: auto 100svh;
	opacity: 0.4;
	filter: drop-shadow(0 34px 70px rgba(0, 0, 0, 0.72))
		drop-shadow(0 0 34px rgba(216, 139, 53, 0.28));
	pointer-events: none;
	user-select: none;
}

.login-shell::after {
	content: '';
	position: absolute;
	z-index: 1;
	inset: 0;
	background:
		radial-gradient(circle at 50% 44%, transparent 0 26%, rgba(0, 0, 0, 0.34) 76%),
		linear-gradient(
			90deg,
			rgba(0, 0, 0, 0.34),
			transparent 26%,
			transparent 72%,
			rgba(0, 0, 0, 0.38)
		);
	pointer-events: none;
}

.ember-field {
	position: fixed;
	z-index: 2;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
}

.ember-field::before {
	content: '';
	position: absolute;
	left: -8vw;
	right: -8vw;
	bottom: -16vh;
	height: 42vh;
	background: radial-gradient(
		ellipse at 50% 100%,
		rgba(255, 171, 61, 0.4),
		rgba(175, 49, 20, 0.22) 38%,
		transparent 72%
	);
	filter: blur(12px);
}

.ember {
	position: absolute;
	left: 5%;
	bottom: 2%;
	width: 3px;
	height: 9px;
	border-radius: 99px;
	background: #ffd36b;
	box-shadow: 0 0 14px #ff9138;
	animation: ember-rise 5.4s ease-out infinite;
}

.ember:nth-child(12n + 1) {
	left: 4%;
	animation-delay: -0.4s;
}
.ember:nth-child(12n + 2) {
	left: 13%;
	width: 2px;
	height: 6px;
	animation-delay: -3.2s;
}
.ember:nth-child(12n + 3) {
	left: 22%;
	animation-delay: -1.1s;
}
.ember:nth-child(12n + 4) {
	left: 31%;
	width: 5px;
	height: 15px;
	animation-delay: -4.7s;
}
.ember:nth-child(12n + 5) {
	left: 39%;
	animation-delay: -2.4s;
}
.ember:nth-child(12n + 6) {
	left: 47%;
	width: 2px;
	height: 6px;
	animation-delay: -5.9s;
}
.ember:nth-child(12n + 7) {
	left: 55%;
	animation-delay: -0.8s;
}
.ember:nth-child(12n + 8) {
	left: 63%;
	width: 4px;
	height: 12px;
	animation-delay: -3.8s;
}
.ember:nth-child(12n + 9) {
	left: 71%;
	animation-delay: -1.7s;
}
.ember:nth-child(12n + 10) {
	left: 79%;
	width: 2px;
	height: 6px;
	animation-delay: -5.1s;
}
.ember:nth-child(12n + 11) {
	left: 87%;
	animation-delay: -2.9s;
}
.ember:nth-child(12n) {
	left: 95%;
	width: 4px;
	height: 12px;
	animation-delay: -6.4s;
}

@keyframes ember-rise {
	from {
		transform: translateY(0) scale(0.4);
		opacity: 0;
	}
	15% {
		opacity: 0.9;
	}
	to {
		transform: translateY(-280px) translateX(35px) scale(0.1);
		opacity: 0;
	}
}

.login-panel {
	position: relative;
	z-index: 4;
	width: min(100%, 500px);
	max-height: calc(100svh - 48px);
	overflow-y: auto;
	border: 1px solid var(--line);
	border-radius: 30px;
	padding: clamp(24px, 4vw, 38px);
	background:
		radial-gradient(circle at 100% 0, rgba(216, 139, 53, 0.12), transparent 38%),
		linear-gradient(180deg, var(--panel), var(--panel-strong));
	box-shadow:
		0 34px 100px rgba(0, 0, 0, 0.6),
		inset 0 0 0 1px rgba(255, 233, 169, 0.05);
	backdrop-filter: blur(14px);
}

.login-panel-heading {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 24px;
}

.login-panel-heading h1 {
	margin: 0;
	font-size: 28px;
}

.login-rune {
	width: 40px;
	height: 40px;
	flex: none;
	display: grid;
	place-items: center;
	border: 1px solid var(--gold);
	border-radius: 17px;
	color: var(--vellum);
	background: linear-gradient(145deg, var(--wine), var(--wine-dark));
	box-shadow: inset 0 2px rgba(255, 255, 255, 0.14);
}

.login-rune svg {
	width: 22px;
	height: 22px;
}

.login-rune-image {
	width: 72px;
	height: 72px;
	border: 0;
	background: transparent;
	box-shadow: none;
	overflow: visible;
}

.login-rune-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.provider-list {
	display: grid;
	gap: 12px;
}

.provider-button {
	width: 100%;
	min-height: 66px;
	display: grid;
	grid-template-columns: 38px 1fr;
	align-items: center;
	gap: 12px;
	border: 1px solid var(--line);
	border-radius: 19px;
	padding: 11px 14px;
	text-align: left;
	color: var(--text);
	background: var(--card);
	text-decoration: none;
	cursor: pointer;
	transition:
		transform 0.14s,
		border-color 0.14s,
		background 0.14s,
		box-shadow 0.14s;
}

.provider-button > svg,
.provider-brand-icon {
	width: 34px;
	height: 34px;
	flex: none;
}

.provider-button.github {
	border-color: rgba(216, 139, 53, 0.6);
	background: linear-gradient(180deg, rgba(114, 34, 42, 0.7), rgba(58, 11, 13, 0.88));
}

.provider-button.google {
	border-color: rgba(66, 133, 244, 0.48);
	background:
		linear-gradient(180deg, rgba(66, 133, 244, 0.13), rgba(52, 168, 83, 0.06)), var(--card);
}

.provider-button.yandex {
	border-color: rgba(252, 63, 29, 0.5);
	background:
		linear-gradient(180deg, rgba(252, 63, 29, 0.13), rgba(114, 34, 42, 0.08)), var(--card);
}

.provider-button.mail {
	border-color: rgba(216, 139, 53, 0.5);
	background:
		linear-gradient(180deg, rgba(216, 139, 53, 0.15), rgba(114, 34, 42, 0.12)), var(--card);
}

.provider-button:not(:disabled):hover {
	transform: translateY(-2px);
	border-color: var(--gold);
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.provider-button:focus-visible,
.mail-login-back:focus-visible,
.mail-auth-submit:focus-visible,
.mail-auth-form input:focus-visible {
	outline: 3px solid rgba(216, 139, 53, 0.42);
	outline-offset: 3px;
}

.provider-button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.provider-button.unavailable {
	opacity: 0.72;
	border-style: dashed;
}

.provider-brand-icon {
	display: grid;
	place-items: center;
	border-radius: 11px;
	background: #0077ff;
	overflow: hidden;
}

.provider-brand-icon img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
}

.provider-brand-icon.google {
	border: 1px solid rgba(255, 255, 255, 0.82);
	background: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.provider-brand-icon.google img {
	width: 22px;
	height: 22px;
}

.provider-brand-icon.yandex {
	background: #fc3f1d;
	box-shadow: 0 4px 12px rgba(252, 63, 29, 0.28);
}

.provider-brand-icon.vk {
	border-radius: 10px;
	background: transparent;
	box-shadow: 0 4px 12px rgba(0, 119, 255, 0.28);
}

.provider-unavailable {
	display: grid;
	gap: 7px;
}

.provider-unavailable p {
	margin: 0;
	border: 1px solid rgba(216, 139, 53, 0.28);
	border-radius: 14px;
	padding: 9px 11px;
	color: var(--muted);
	font-size: 12px;
	line-height: 1.35;
	background: rgba(0, 0, 0, 0.16);
}

.auth-alert {
	display: grid;
	gap: 4px;
	margin-bottom: 18px;
	border: 1px solid rgba(200, 93, 77, 0.7);
	border-radius: 17px;
	padding: 12px 14px;
	color: #ffd8cf;
	background: rgba(114, 34, 42, 0.36);
}

.auth-alert span {
	font-size: 13px;
	line-height: 1.4;
}

.mail-login-panel {
	display: grid;
	gap: 18px;
}

.mail-login-panel .login-panel-heading {
	margin-bottom: 0;
}

.mail-login-back {
	width: fit-content;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
}

.mail-login-back:hover {
	color: var(--gold);
}

.mail-login-back svg {
	width: 17px;
	height: 17px;
}

.mail-auth-panel {
	display: grid;
	gap: 12px;
	border: 1px solid rgba(216, 139, 53, 0.35);
	border-radius: 19px;
	padding: 14px;
	background: rgba(0, 0, 0, 0.2);
	box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.mail-auth-form {
	display: grid;
	gap: 9px;
}

.mail-auth-form label {
	font-size: 13px;
	font-weight: 700;
}

.mail-auth-form input {
	width: 100%;
	min-height: 48px;
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 10px 12px;
	color: var(--text);
	background: rgba(0, 0, 0, 0.25);
	outline: none;
}

.mail-auth-form input:focus {
	border-color: var(--gold);
	box-shadow: 0 0 0 3px rgba(216, 139, 53, 0.14);
}

.mail-auth-code-input {
	font-size: 24px;
	font-weight: 700;
	letter-spacing: 0.3em;
	text-align: center;
}

.mail-auth-hint {
	margin: 0;
	color: var(--muted);
	font-size: 12px;
	line-height: 1.4;
}

.mail-auth-submit {
	min-height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	border: 1px solid rgba(216, 139, 53, 0.65);
	border-radius: 14px;
	padding: 10px 14px;
	color: var(--vellum);
	font-weight: 700;
	background: linear-gradient(180deg, rgba(143, 48, 39, 0.95), rgba(76, 16, 17, 0.95));
	cursor: pointer;
}

.mail-auth-submit:hover {
	border-color: var(--gold);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

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

.mail-auth-message {
	border-radius: 13px;
	padding: 10px 11px;
	font-size: 12px;
	line-height: 1.4;
}

.mail-auth-message.error {
	border: 1px solid rgba(200, 93, 77, 0.65);
	color: #ffd8cf;
	background: rgba(114, 34, 42, 0.32);
}

.mail-auth-message.success {
	border: 1px solid rgba(110, 176, 112, 0.5);
	color: #dff5d9;
	background: rgba(43, 91, 52, 0.28);
}

@media (max-width: 560px) {
	.login-shell {
		padding: 18px;
	}

	.login-shell::before {
		background-position: center center;
		background-size: 620px auto;
		opacity: 0.34;
	}
}

@media (prefers-reduced-motion: reduce) {
	.provider-button {
		transition: none;
	}

	.ember {
		animation: none;
		display: none;
	}
}
