:root {
    --bg: #050816;
    --bg-soft: #0a1020;
    --panel: rgba(12, 19, 36, 0.88);
    --panel-strong: rgba(10, 16, 30, 0.96);
    --line: rgba(148, 163, 184, 0.14);
    --line-strong: rgba(124, 58, 237, 0.28);

    --text: #f8fbff;
    --text-soft: #b9c4dc;
    --text-muted: #8691ab;

    --accent: #7c3aed;
    --accent-2: #4f46e5;

    --danger: #ef4444;
    --success: #22c55e;
    --info: #38bdf8;

    --shadow-lg: 0 30px 80px rgba(2, 6, 23, 0.48);
    --shadow-md: 0 16px 36px rgba(2, 6, 23, 0.28);
    --radius-xl: 32px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

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

body.auth-body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 14%, rgba(124, 58, 237, 0.16), transparent 22%),
        radial-gradient(circle at 86% 10%, rgba(79, 70, 229, 0.14), transparent 20%),
        linear-gradient(180deg, #050713 0%, #070b18 100%);
    overflow-x: hidden;
}

body.auth-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 42px 42px;
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(100%, 520px);
    position: relative;
    padding: 34px 34px 28px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(148, 163, 184, 0.10);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
        linear-gradient(180deg, #0c1428 0%, #09101f 100%);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
    overflow: hidden;
    animation: authFadeUp 0.7s ease both;
}

.auth-shell::before {
    content: "";
    position: absolute;
    top: -90px;
    right: -80px;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.16), transparent 68%);
    filter: blur(18px);
    pointer-events: none;
}

.auth-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), transparent 24%);
    opacity: 0.5;
}

.auth-shell > * {
    position: relative;
    z-index: 1;
}

.auth-shell-register {
    width: min(100%, 640px);
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    margin-bottom: 26px;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 1.5px;
    transition: transform 0.18s ease;
}

.auth-logo:hover {
    transform: translateY(-1px);
}

.auth-logo-u,
.auth-logo-s {
    color: #eef2ff;
}

.auth-logo-m {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header {
    margin-bottom: 22px;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(124, 58, 237, 0.24);
    background: rgba(79, 70, 229, 0.08);
    color: #dfe6ff;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.auth-header h1 {
    margin: 0 0 10px;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 0.96;
    letter-spacing: -0.06em;
    color: #fff;
}

.auth-header p {
    margin: 0;
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1.65;
}

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

.auth-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-field-full {
    grid-column: 1 / -1;
}

.auth-field label {
    color: #dbe3f9;
    font-size: 0.93rem;
    font-weight: 700;
}

.auth-field input {
    min-height: 58px;
    width: 100%;
    padding: 0 18px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        linear-gradient(180deg, rgba(18, 24, 45, 0.88), rgba(10, 14, 28, 0.96));
    color: #fff;
    font-size: 1rem;
    outline: none;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 8px 16px rgba(0,0,0,0.22);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.auth-field input::placeholder {
    color: #7f8aa3;
}

.auth-field input:hover {
    border-color: rgba(124, 58, 237, 0.22);
}

.auth-field input:focus {
    border-color: rgba(124, 58, 237, 0.58);
    box-shadow:
        0 0 0 4px rgba(124, 58, 237, 0.14),
        0 14px 28px rgba(0,0,0,0.30);
    transform: translateY(-1px);
}

.auth-btn {
    min-height: 58px;
    border-radius: 18px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    cursor: pointer;
}

.auth-btn-primary {
    margin-top: 4px;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed, #9333ea);
    box-shadow: 0 14px 30px rgba(124, 58, 237, 0.34);
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 38px rgba(124, 58, 237, 0.42);
}

.auth-btn-full {
    grid-column: 1 / -1;
}

.auth-footer-text {
    margin: 18px 0 10px;
    color: var(--text-soft);
    text-align: center;
    line-height: 1.6;
}

.auth-footer-text a {
    color: #f0e7ff;
    font-weight: 800;
}

.auth-footer-text a:hover {
    color: #fff;
}

.auth-back-link {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: color 0.18s ease;
}

.auth-back-link:hover {
    color: #fff;
}

.auth-flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 4px;
}

.auth-flash {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 14px;
    font-weight: 700;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.auth-flash-error {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}

.auth-flash-success {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
}

.auth-flash-info {
    background: rgba(56, 189, 248, 0.12);
    color: #bae6fd;
}

@keyframes authFadeUp {
    0% {
        opacity: 0;
        transform: translateY(16px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .auth-page {
        padding: 16px;
    }

    .auth-shell,
    .auth-shell-register {
        width: 100%;
        padding: 26px 20px 22px;
        border-radius: 24px;
    }

    .auth-header h1 {
        font-size: 2.2rem;
    }

    .auth-form-grid {
        grid-template-columns: 1fr;
    }

    .auth-field-full,
    .auth-btn-full {
        grid-column: auto;
    }

    .auth-logo {
        font-size: 30px;
        margin-bottom: 22px;
    }
}

.auth-shell {
    --mx: 50%;
    --my: 50%;
}

.auth-shell::before {
    background:
        radial-gradient(circle at var(--mx) var(--my), rgba(124, 58, 237, 0.16), transparent 34%),
        radial-gradient(circle, rgba(124, 58, 237, 0.16), transparent 68%);
}

.auth-shell-login {
    max-width: 540px;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-inline-link {
    color: #d7ccff;
    font-size: 0.84rem;
    font-weight: 700;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.auth-inline-link:hover {
    color: #ffffff;
}

.auth-divider {
    position: relative;
    margin: 18px 0 8px;
    text-align: center;
}

.auth-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.18), transparent);
}

.auth-divider span {
    position: relative;
    z-index: 1;
    padding: 0 12px;
    background: linear-gradient(180deg, #0c1428 0%, #09101f 100%);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.auth-field {
    position: relative;
    opacity: 0;
    transform: translateY(10px);
}

.auth-field.auth-field-reveal {
    animation: authFieldReveal 0.55s ease forwards;
    animation-delay: var(--auth-delay, 0s);
}

.auth-field.is-focused label,
.auth-field.has-value label {
    color: #ffffff;
}

.auth-field-password input {
    padding-right: 84px;
}

.auth-password-toggle {
    position: absolute;
    right: 16px;
    bottom: 15px;
    min-width: 52px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #dbe3f9;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
}

.auth-password-toggle:hover {
    background: rgba(124, 58, 237, 0.18);
    border-color: rgba(124, 58, 237, 0.26);
    color: #fff;
}

.auth-btn.is-loading {
    opacity: 0.82;
    cursor: wait;
    transform: none;
}

.auth-shell-ready {
    animation: authShellFloat 5.5s ease-in-out infinite;
}

@keyframes authFieldReveal {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes authShellFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-2px);
    }
}

@media (max-width: 720px) {
    .auth-label-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .auth-password-toggle {
        bottom: 14px;
    }
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-inline-link {
    color: #d7ccff;
    font-size: 0.84rem;
    font-weight: 700;
    transition: color 0.18s ease;
}

.auth-inline-link:hover {
    color: #ffffff;
}