:root {
    --bg: #0a0812;
    --card: #14101f;
    --surface: rgba(255,255,255,0.03);
    --border: rgba(255,255,255,0.08);
    --border2: rgba(155,92,255,0.35);
    --accent: #9b5cff;
    --accent2: #7c3aed;
    --text: #f2eefb;
    --text2: #a79bc4;
    --muted: #7a6f96;
    --green: #34e0a1;
    --red: #ff6b8b;
    --radius: 16px;
    --font: 'Manrope', sans-serif;
}
* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    line-height: 1.55;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(155,92,255,0.35); color: #fff; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px 28px;
}

.brand-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.brand-mark img { width: 34px; height: 34px; border-radius: 9px; }
.brand-mark span { font-weight: 800; font-size: 16px; color: var(--text); }

.auth-header { margin-bottom: 22px; }
.auth-header h1 { font-size: 1.15rem; font-weight: 700; }
.auth-header p { font-size: 13px; color: var(--text2); margin-top: 6px; display: flex; align-items: center; gap: 8px; font-weight: 500; }

.login-buttons { display: flex; flex-direction: column; gap: 10px; }
.login-btn {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    padding: 13px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; font-family: var(--font);
    text-decoration: none; color: #fff; border: 1px solid transparent; cursor: pointer;
    transition: filter 0.15s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation; width: 100%;
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { filter: brightness(0.95); }
.login-btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.vk-login-btn { background: #3f7fc9; }
.passkey-btn { background: var(--accent2); }
.continue-btn { background: var(--accent2); }
.ghost-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text2); }
.ghost-btn:hover { color: var(--text); border-color: var(--border2); }
.danger-link { background: rgba(255,107,139,0.1); color: var(--red); border: 1px solid rgba(255,107,139,0.22); text-decoration: none; }
.danger-link:hover { background: rgba(255,107,139,0.16); }

.code-input {
    width: 100%; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-family: var(--font); font-size: 16px;
    font-weight: 700; letter-spacing: 0.1em; text-align: center; outline: none; transition: border-color 0.15s;
}
.code-input:focus { border-color: var(--border2); }
.code-input::placeholder { color: var(--muted); letter-spacing: normal; font-weight: 500; }

.profile-link-card {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text);
    margin-bottom: 10px; transition: border-color 0.15s;
}
.profile-link-card:hover { border-color: var(--border2); }
.profile-link-card .pl-icon { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    background: var(--accent2); font-size: 14px; }
.profile-link-card .pl-text { flex: 1; min-width: 0; }
.profile-link-card .pl-title { font-size: 13px; font-weight: 700; }
.profile-link-card .pl-sub { font-size: 11px; color: var(--text2); font-weight: 500; margin-top: 1px; }
.profile-link-card .pl-arrow { color: var(--text2); font-size: 12px; flex-shrink: 0; }

.spinner-sm { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.65s linear infinite; flex-shrink: 0; display: inline-block; }
.loader-spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-message, .success-message {
    display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; border-radius: 12px;
    font-size: 13px; font-weight: 600; line-height: 1.5; margin-bottom: 16px;
}
.error-message { background: rgba(255,107,139,0.1); border: 1px solid rgba(255,107,139,0.24); color: var(--red); }
.success-message { background: rgba(52,224,161,0.1); border: 1px solid rgba(52,224,161,0.24); color: var(--green); }

.privacy-policy { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: var(--text2); font-weight: 500;
    border-radius: 12px; padding: 4px 0 0; cursor: pointer; margin-top: 16px; }
.privacy-checkbox { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; min-width: 16px; border: 2px solid var(--border2);
    border-radius: 5px; background: transparent; cursor: pointer; margin-top: 1px; transition: background 0.15s; position: relative; }
.privacy-checkbox:checked { background: var(--accent2); border-color: var(--accent2); }
.privacy-checkbox:checked::after { content: ''; position: absolute; left: 3px; top: 1px; width: 7px; height: 4px; border: 2px solid #fff; border-top: none; border-right: none; transform: rotate(-45deg); display: block; }
.privacy-label { line-height: 1.5; cursor: pointer; }
.privacy-label a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

.captcha-footnote { display: flex; align-items: center; justify-content: flex-start; gap: 6px; flex-wrap: wrap; margin-top: 14px;
    font-size: 11px; color: var(--muted); }
.captcha-footnote a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.captcha-footnote a:hover { color: var(--text2); }

.page-loader { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 1000; }

.avatar-ring { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; background: var(--accent2); padding: 2px; }
.avatar-ring img { width: 100%; height: 100%; border-radius: 50%; display: block; object-fit: cover; background: var(--card); }

.cookie-popup { position: fixed; bottom: -140px; left: 0; right: 0; z-index: 600; background: var(--card); border-top: 1px solid var(--border);
    padding: 14px 20px; padding-bottom: calc(14px + env(safe-area-inset-bottom,0px));
    display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text2); font-weight: 500;
    transition: bottom 0.3s ease; flex-wrap: wrap; }
.cookie-popup.show { bottom: 0; }
.cookie-popup a { color: var(--text); text-decoration: underline; }
.cookie-popup button { flex-shrink: 0; padding: 9px 16px; border-radius: 10px; border: none; cursor: pointer; font-family: var(--font);
    font-weight: 700; font-size: 13px; background: var(--accent2); color: #fff; }
.cookie-popup p { flex: 1; min-width: 180px; }

@media (max-width: 480px) {
    .auth-card { padding: 26px 20px; }
}

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse 80% 55% at 12% 4%, rgba(124, 58, 237, 0.13) 0%, transparent 55%), radial-gradient(ellipse 55% 38% at 88% 88%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
}

canvas#particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.profile-grid > .section,
.profile-passkey > .section {
    height: 100%;
}

.profile-shell {
    max-width: 900px !important;
}

.profile-card,
.profile-grid > .section,
.profile-passkey > .section,
.danger-zone {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
    animation: profile-rise 0.45s ease both;
}

.profile-grid > .section { animation-delay: 0.06s; }
.profile-passkey > .section { animation-delay: 0.12s; }
.danger-zone { animation-delay: 0.18s; }

@keyframes profile-rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}
