﻿* { box-sizing: border-box; }

:root {
    --auth-text: #f4f6f8;
    --auth-muted: #aeb6bf;
    --auth-panel: rgba(9, 10, 11, .9);
    --auth-panel-line: rgba(207, 211, 216, .16);
    --auth-field: rgba(4, 5, 6, .58);
    --auth-accent: #cfd3d8;
    --auth-accent-soft: rgba(207, 211, 216, .12);
    --auth-error: #ffb4b4;
    --auth-ok: #a7f3d0;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #050505 0%, #101113 48%, #08090a 100%);
    color: var(--auth-text);
    font-family: Arial, "Helvetica Neue", sans-serif;
    letter-spacing: 0;
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .18;
    animation: drift 12s ease-in-out infinite alternate;
}

body::before {
    left: -140px;
    top: -120px;
    background: #cfd3d8;
}

body::after {
    right: -160px;
    bottom: -140px;
    background: #9ca9b5;
    animation-delay: -4s;
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(1080px, calc(100% - 32px));
    min-height: min(720px, calc(100vh - 32px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 470px);
    overflow: hidden;
    border: 1px solid var(--auth-panel-line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent), var(--auth-panel);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .58);
    backdrop-filter: blur(18px);
    animation: enter .55s ease both;
}

.login-visual {
    position: relative;
    min-height: 560px;
    background: url("../img/bg.png") center / cover no-repeat;
}

.login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(7, 7, 6, .06), rgba(7, 7, 6, .74)),
        linear-gradient(0deg, rgba(7, 7, 6, .38), transparent 58%);
}

.login-form-panel,
.qr-card {
    background: linear-gradient(90deg, rgba(207, 211, 216, .07), transparent 36%), rgba(9, 10, 11, .92);
}

.login-form-panel {
    width: 470px;
    min-width: 0;
    padding: 30px;
    overflow-y: auto;
}

.qr-card {
    position: relative;
    z-index: 1;
    width: min(460px, calc(100% - 30px));
    padding: 28px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 14px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .58);
    animation: enter .45s ease both;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin-bottom: 30px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 10px;
    object-fit: contain;
    padding: 5px;
    background: rgba(255, 255, 255, .04);
}

.brand strong { display: block; font-size: 15px; }
.brand span:last-child, .brand span { color: var(--auth-muted); font-size: 12px; }

h1 {
    margin: 0 0 8px;
    font-size: 25px;
    line-height: 1.15;
}

.subtitle {
    margin: 0 0 22px;
    color: var(--auth-muted);
    font-size: 14px;
    line-height: 1.5;
}

.login-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    min-width: 0;
    margin-bottom: 18px;
    padding: 4px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 10px;
    background: rgba(18, 18, 17, .72);
}

.method-btn {
    min-width: 0;
    min-height: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--auth-muted);
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.method-btn:hover { transform: translateY(-1px); }
.method-btn.is-active { background: var(--auth-accent); color: #0b0a08; }
.method-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
}

.form, .actions {
    display: grid;
    gap: 14px;
    width: 100%;
    min-width: 0;
    animation: enter .34s ease both;
}

.auth-step {
    min-height: 0;
}

.auth-step.is-hidden {
    display: none;
}

.identity-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    min-width: 0;
}

.identity-grid label,
.avatar-field {
    min-width: 0;
}

.register-steps {
    gap: 16px;
}

.register-step {
    display: none;
    gap: 14px;
    min-width: 0;
    animation: enter .28s ease both;
}

.register-step.is-active {
    display: grid;
}

.step-indicator {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.step-indicator span {
    min-height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid var(--auth-panel-line);
    border-radius: 9px;
    color: var(--auth-muted);
    background: rgba(207, 211, 216, .05);
    font-size: 12px;
    font-weight: 900;
}

.step-indicator span.is-active {
    color: #0b0a08;
    background: var(--auth-accent);
}

.step-title {
    display: grid;
    gap: 3px;
}

.step-title span,
label small {
    color: var(--auth-muted);
    font-size: 11px;
    font-weight: 700;
}

.step-title strong {
    color: var(--auth-text);
    font-size: 16px;
}

.step-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.step-actions button:only-child {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 8px;
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 9px;
    outline: 0;
    background: var(--auth-field);
    color: var(--auth-text);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

input:focus {
    border-color: rgba(207, 211, 216, .84);
    box-shadow: 0 0 0 4px var(--auth-accent-soft);
    transform: translateY(-1px);
}

.avatar-upload {
    min-height: 82px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 12px;
    background: var(--auth-field);
    position: relative;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.avatar-upload:hover {
    border-color: rgba(207, 211, 216, .84);
    box-shadow: 0 0 0 4px var(--auth-accent-soft);
    transform: translateY(-1px);
}

.avatar-preview {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 16px;
    color: #0b0a08;
    background: linear-gradient(135deg, #ffffff, #d3d3d3 52%, #1c1c1c);
    font-size: 18px;
    font-weight: 900;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-upload-text {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.avatar-upload-text strong {
    color: var(--auth-text);
    font-size: 13px;
}

.avatar-upload-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 9px;
    background: var(--auth-accent);
    color: #0b0a08;
    font-size: 12px;
    font-weight: 900;
}

.avatar-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}


.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 4px;
    color: var(--auth-muted);
    font-size: 12px;
}

.auth-link,
.qr-entry-link {
    color: var(--auth-accent);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.auth-link:hover,
.qr-entry-link:hover {
    text-decoration: underline;
}

.row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.row input {
    appearance: none;
    inline-size: 18px;
    block-size: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    flex: 0 0 18px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 5px;
    cursor: pointer;
}

.row input::before {
    content: "";
    width: 8px;
    height: 5px;
    border-left: 2px solid #0b0a08;
    border-bottom: 2px solid #0b0a08;
    opacity: 0;
    transform: rotate(-45deg) translate(1px, -1px);
    transition: opacity .16s ease;
}

.row input:checked {
    border-color: var(--auth-accent);
    background: var(--auth-accent);
    box-shadow: 0 0 0 4px var(--auth-accent-soft);
}

.row input:checked::before { opacity: 1; }

.login-summary {
    display: grid;
    gap: 4px;
    padding: 12px 13px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 10px;
    background: rgba(207, 211, 216, .06);
}

.login-summary span {
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 700;
}

.login-summary strong {
    color: var(--auth-text);
    font-size: 15px;
    overflow-wrap: anywhere;
}

.submit-btn {
    min-height: 44px;
    border: 0;
    border-radius: 9px;
    background: var(--auth-accent);
    color: #0b0a08;
    font-weight: 900;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(207, 211, 216, .18);
}

.submit-btn:active { transform: translateY(0); opacity: .86; }

.error {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 138, 138, .28);
    border-radius: 9px;
    background: rgba(255, 138, 138, .08);
    color: var(--auth-error);
    font-size: 13px;
    animation: shake .22s ease;
}

.notice {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(207, 211, 216, .22);
    border-radius: 9px;
    background: rgba(207, 211, 216, .08);
    color: var(--auth-text);
    font-size: 13px;
    line-height: 1.4;
}

.qr-panel {
    display: none;
    gap: 10px;
    width: 100%;
    min-width: 0;
    animation: enter .34s ease both;
}
.qr-panel.is-active { display: grid; }

.qr-login-inline {
    margin-top: 16px;
}

.qr-box, .camera-box {
    display: grid;
    place-items: center;
    border: 1px dashed rgba(207, 211, 216, .34);
    border-radius: 12px;
    background:
        linear-gradient(90deg, rgba(207, 211, 216, .08) 1px, transparent 1px),
        linear-gradient(rgba(207, 211, 216, .08) 1px, transparent 1px),
        rgba(18, 18, 17, .74);
    background-size: 22px 22px;
}

.qr-box {height: 380px;}
.camera-box { position: relative; overflow: hidden; aspect-ratio: 1 / 1; }

.qr-code {
    width: 242px;
    height: 242px;
    display: block;
    padding: 8px;
    border-radius: 10px;
    background: #f4f6f8;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .34);
}

.qr-code img, video {
    width: 100%;
    height: 100%;
    display: block;
}

.qr-code img { border-radius: 6px; }
video { object-fit: cover; }

.qr-note, .message {
    margin: 0;
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
}

.qr-entry-link {
    display: inline-flex;
    justify-content: center;
    margin-top: 10px;
}

.message { min-height: 20px; margin-top: 14px; text-align: left; }
.message.error { color: var(--auth-error); }
.message.ok { color: var(--auth-ok); }

.profile-card {
    position: relative;
    z-index: 1;
    width: min(760px, calc(100% - 32px));
    display: grid;
    gap: 18px;
    padding: 28px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent), var(--auth-panel);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .58);
    backdrop-filter: blur(18px);
    animation: enter .45s ease both;
}

.profile-top {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 900;
}

.profile-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border: 1px solid var(--auth-panel-line);
    border-radius: 10px;
    padding: 5px;
    background: rgba(255, 255, 255, .04);
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    overflow: hidden;
    border: 1px solid var(--auth-panel-line);
    border-radius: 26px;
    object-fit: cover;
    background: linear-gradient(135deg, #ffffff, #d3d3d3 52%, #1c1c1c);
}

.profile-kicker,
.profile-grid span {
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 800;
}

.profile-hero h1 {
    margin: 6px 0 6px;
    font-size: clamp(28px, 6vw, 48px);
    line-height: 1;
    overflow-wrap: anywhere;
}

.profile-hero p {
    margin: 0;
    color: var(--auth-muted);
    overflow-wrap: anywhere;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.profile-grid article {
    min-width: 0;
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 12px;
    background: rgba(207, 211, 216, .06);
}

.profile-grid strong {
    color: var(--auth-text);
    overflow-wrap: anywhere;
}

.profile-qr-scanner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--auth-panel-line);
    border-radius: 12px;
    background: rgba(207, 211, 216, .06);
}

.profile-qr-scanner strong {
    display: block;
    margin-top: 5px;
    color: var(--auth-text);
    font-size: 15px;
}

.profile-qr-scanner p {
    margin: 7px 0 0;
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.4;
}

.scanner-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.scanner-panel {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
}

.scanner-panel[hidden] {
    display: none;
}

.profile-qr-scanner .camera-box {
    max-width: 360px;
    width: 100%;
    justify-self: center;
}

.profile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.profile-actions .submit-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.profile-edit {
    margin-top: 4px;
}

.ghost-btn {
    border: 1px solid var(--auth-panel-line);
    background: rgba(207, 211, 216, .08);
    color: var(--auth-text);
}

.scan-frame {
    position: absolute;
    inset: 18%;
    border: 1px solid rgba(207, 211, 216, .68);
    border-radius: 14px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .26);
    pointer-events: none;
}

.scan-frame::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    top: 16%;
    height: 2px;
    border-radius: 2px;
    background: var(--auth-accent);
    animation: scan 1.8s ease-in-out infinite alternate;
}

@keyframes enter {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(36px, 28px, 0) scale(1.08); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    35% { transform: translateX(-4px); }
    70% { transform: translateX(4px); }
}

@keyframes scan {
    from { transform: translateY(0); }
    to { transform: translateY(150px); }
}

@media (prefers-reduced-motion: reduce) {
    *, body::before, body::after { animation: none !important; transition: none !important; }
}

@media (max-width: 820px) {
    body { overflow: auto; }
    .login-card {
        height: auto;
        min-height: 0;
        grid-template-columns: 1fr;
    }
    .login-form-panel {
        width: 100%;
        overflow: visible;
    }
    .login-visual { min-height: 220px; }
    .identity-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    body { padding: 12px; }
    .login-card { width: 100%; border-radius: 12px; }
    .login-form-panel { padding: 22px; }
    .login-methods { grid-template-columns: 1fr; }
    .row { align-items: flex-start; flex-direction: column; }
    .profile-card { width: 100%; padding: 20px; }
    .profile-hero { align-items: flex-start; flex-direction: column; }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-qr-scanner { grid-template-columns: 1fr; }
    .scanner-actions { justify-content: stretch; }
    .scanner-actions .method-btn { flex: 1; }
    .profile-actions .submit-btn { width: 100%; }
}


