:root {
    color-scheme: dark;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --text: #f8f8fa;
    --muted: #99999f;
    --line: rgba(255, 255, 255, 0.15);
    --orange: #ff7417;
    --danger: #fb7185;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-width: 320px; min-height: 100%; }
body { margin: 0; color: var(--text); background: #08090b; }
button, input { font: inherit; }

.auth-background {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 4%, rgba(22, 47, 91, 0.3), transparent 36rem),
        radial-gradient(circle at 88% 15%, rgba(249, 91, 17, 0.18), transparent 34rem),
        linear-gradient(100deg, rgba(3, 5, 9, 0.91), rgba(5, 6, 9, 0.78) 50%, rgba(7, 4, 6, 0.9)),
        url("/img/auth-login-background.jpg") center center / cover fixed no-repeat;
}

.auth-background::before {
    position: fixed;
    inset: 0;
    content: "";
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(4, 5, 8, 0.12), rgba(4, 5, 8, 0.5)),
        radial-gradient(ellipse at center, transparent 22%, rgba(3, 4, 6, 0.72) 100%);
}

.auth-main {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 38px 18px;
}

.auth-card {
    width: min(100%, 560px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 30px;
    padding: 48px 54px 44px;
    background: linear-gradient(145deg, rgba(23, 24, 27, 0.95), rgba(10, 11, 13, 0.97));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 35px 100px rgba(0, 0, 0, 0.58);
    text-align: center;
    backdrop-filter: blur(26px) saturate(125%);
}

.auth-card h1 {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(2rem, 6vw, 2.7rem);
    letter-spacing: -0.045em;
}

.auth-icon {
    display: grid;
    width: 84px;
    height: 84px;
    margin: 0 auto 28px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.085);
    color: #f3f3f4;
}

.auth-icon svg {
    width: 39px;
    height: 39px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.auth-icon--danger { background: rgba(127, 29, 29, 0.24); color: var(--danger); }
.auth-lead { margin: 18px 0 0; color: #c2c2c7; font-size: 1.05rem; }
.auth-copy { margin: 13px auto 29px; color: var(--muted); font-size: 0.82rem; line-height: 1.55; }
.auth-form, .auth-fields { display: grid; gap: 17px; }
.auth-field { display: grid; gap: 8px; text-align: left; }
.auth-field > span { color: #ececef; font-size: 0.79rem; font-weight: 700; }
.auth-input {
    width: 100%;
    min-height: 54px;
    border: 1px solid rgba(255, 255, 255, 0.19);
    border-radius: 13px;
    outline: none;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.045);
    color: white;
    transition: 160ms ease;
}
.auth-input::placeholder { color: #77777e; }
.auth-input:hover { border-color: rgba(255, 255, 255, 0.27); }
.auth-input:focus { border-color: rgba(255, 116, 23, 0.7); box-shadow: 0 0 0 4px rgba(255, 116, 23, 0.1); }
.auth-input--code { text-align: center; font-size: 1.25rem; font-weight: 800; letter-spacing: 0.4em; }
.auth-field-help { margin: -7px 0 0; color: var(--muted); font-size: 0.73rem; line-height: 1.5; }

.auth-button {
    display: inline-flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0 18px;
    background: linear-gradient(135deg, #ff8a3c, #ff5e0b);
    box-shadow: 0 15px 36px rgba(249, 99, 18, 0.22);
    color: white;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: 160ms ease;
}
.auth-form > .auth-button { margin-top: 3px; }
.auth-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.auth-button:disabled { cursor: wait; opacity: 0.62; }
.auth-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.auth-button--secondary { border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.035); box-shadow: none; color: #f1f1f3; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0 22px; color: #8d8d94; font-size: 0.69rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; content: ""; background: rgba(255, 255, 255, 0.14); }
.auth-divider span { white-space: nowrap; }
.auth-help { margin: 28px 0 0; color: #8c8c93; font-size: 0.74rem; line-height: 1.6; }
.auth-help span { color: #d5d5d9; font-weight: 700; }
.auth-link { color: #f4f4f5; font-weight: 700; text-decoration: none; }
.auth-link:hover { color: var(--orange); }
.auth-link--aside { align-self: flex-end; margin-top: -0.35rem; font-size: 0.78rem; }
.auth-back { justify-self: start; border: 0; padding: 0; background: transparent; color: #aaaab1; cursor: pointer; font-size: 0.75rem; }
.auth-back:hover { color: white; }

.auth-alert { margin: 0 0 19px; border: 1px solid rgba(251, 113, 133, 0.3); border-radius: 12px; padding: 12px 14px; background: rgba(127, 29, 29, 0.2); color: #fecdd3; font-size: 0.76rem; font-weight: 600; line-height: 1.5; }
.auth-alert--success { border-color: rgba(52, 211, 153, 0.25); background: rgba(6, 78, 59, 0.2); color: #a7f3d0; }

.auth-actions { display: grid; gap: 11px; }

/* Authentication pages share one visual frame, while their height follows
   the actual content. The document may scroll on short screens; the card
   itself must never introduce a second scrollbar. */
.auth-card--compact {
    width: min(100%, 420px);
    border-radius: 24px;
    padding: 36px 40px 33px;
    overflow: visible;
}
.auth-card--compact h1 { font-size: clamp(1.75rem, 5vw, 2.05rem); }
.auth-card--compact .auth-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
}
.auth-card--compact .auth-icon svg { width: 30px; height: 30px; }
.auth-card--compact .auth-lead { margin-top: 13px; font-size: 0.9rem; }
.auth-card--compact .auth-copy { margin: 9px auto 21px; font-size: 0.73rem; }
.auth-card--compact .auth-form,
.auth-card--compact .auth-fields { gap: 13px; }
.auth-card--compact .auth-field { gap: 6px; }
.auth-card--compact .auth-field > span { font-size: 0.72rem; }
.auth-card--compact .auth-input {
    min-height: 46px;
    border-radius: 11px;
    padding: 0 14px;
    font-size: 0.88rem;
}
.auth-card--compact .auth-button {
    min-height: 46px;
    border-radius: 11px;
    font-size: 0.88rem;
}
.auth-card--compact .auth-divider { margin: 20px 0 16px; font-size: 0.62rem; }
.auth-card--compact .auth-help { margin-top: 20px; font-size: 0.67rem; }
.auth-card--compact .auth-alert { margin-bottom: 14px; padding: 10px 12px; }

.auth-steps { display: grid; gap: 9px; margin: 0 0 19px; padding: 0; list-style: none; text-align: left; }
.auth-steps li { display: grid; grid-template-columns: 27px 1fr; gap: 10px; align-items: start; }
.auth-steps li > span { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid rgba(255, 116, 23, 0.35); border-radius: 999px; background: rgba(255, 116, 23, 0.09); color: #ff9a57; font-size: 0.68rem; font-weight: 800; }
.auth-steps p { margin: 0; color: var(--muted); font-size: 0.68rem; line-height: 1.45; }
.auth-steps strong { display: block; margin-bottom: 1px; color: #e8e8eb; font-size: 0.72rem; }

.auth-card--danger {
    border-color: rgba(251, 113, 133, 0.34);
    background:
        radial-gradient(circle at 50% 0, rgba(153, 27, 27, 0.22), transparent 47%),
        linear-gradient(145deg, rgba(31, 20, 23, 0.97), rgba(13, 10, 12, 0.98));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 35px 100px rgba(75, 5, 16, 0.38);
}
.auth-card--danger .auth-lead { line-height: 1.55; }
.auth-card--danger .auth-lead strong { color: #fff; }
.auth-warning-copy { margin: 18px 0; color: #aaa0a4; font-size: 0.71rem; line-height: 1.55; text-align: left; }
.auth-warning-copy p { margin: 0 0 11px; }
.auth-warning-copy a { color: #fecdd3; font-weight: 700; text-decoration-color: rgba(254, 205, 211, 0.45); text-underline-offset: 2px; }
.auth-warning-copy a:hover { color: white; }
.auth-button--danger { background: linear-gradient(135deg, #e5485f, #a9162f); box-shadow: 0 15px 36px rgba(159, 18, 47, 0.24); }

@media (max-width: 600px) {
    .auth-main { padding: 12px; }
    .auth-card { border-radius: 23px; padding: 34px 24px 31px; }
    .auth-icon { width: 72px; height: 72px; margin-bottom: 22px; }
    .auth-card--compact { border-radius: 20px; padding: 28px 20px 26px; }
    .auth-card--compact .auth-icon { width: 60px; height: 60px; margin-bottom: 18px; }
    .auth-background { background-position: 58% center; background-attachment: scroll; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}
