/* v40.3: Вход/регистрация «Hi! Community» — по референсу пользователя (итд-стайл):
   чёрный фон, центрированный логотип, крупный заголовок слева, высокие поля
   с подписями, белая pill-кнопка, синяя ссылка «Создать аккаунт» */

:root {
    --a4-bg: #000000;
    --a4-field: #131313;
    --a4-field-border: #232323;
    --a4-text: #ffffff;
    --a4-muted: #9c9c9c;
    --a4-dim: #6f6f78;
    --a4-blue: #4d7dff;
    --a4-accent: #8b7cf7;
    --a4-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }

body.auth-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--a4-bg);
    color: var(--a4-text);
    font-family: var(--a4-font);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 22px calc(28px + env(safe-area-inset-bottom));
}

.auth-shell {
    width: 100%;
    max-width: 430px;
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
}

/* ---------- Логотип ---------- */

.a4-brand {
    display: flex;
    justify-content: center;
    margin: 9vh 0 0;
}

.a4-brand img {
    height: 42px;
    width: auto;
    display: block;
}

/* ---------- Заголовок ---------- */

.a4-head { margin-top: 8.5vh; }

.a4-head h1 {
    margin: 0;
    font-size: clamp(2.1rem, 8vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
}

.a4-head p {
    margin: .7rem 0 0;
    color: var(--a4-muted);
    font-size: 1.12rem;
    line-height: 1.45;
}

/* ---------- Поля ---------- */

.a4-group { margin-top: 2.1rem; }

.a4-label {
    display: block;
    margin: 0 0 .7rem;
    font-size: .98rem;
    font-weight: 500;
    color: var(--a4-text);
}

.a4-group + .a4-group { margin-top: 1.5rem; }

.a4-field { position: relative; }

.a4-field input {
    width: 100%;
    height: 62px;
    padding: 0 54px 0 20px;
    background: var(--a4-field);
    border: 1px solid var(--a4-field-border);
    border-radius: 16px;
    color: var(--a4-text);
    font-family: inherit;
    font-size: 1.02rem;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.a4-field input::placeholder { color: var(--a4-dim); }

.a4-field input:focus {
    border-color: rgba(139, 124, 247, .75);
    box-shadow: 0 0 0 3px rgba(139, 124, 247, .16);
    background: #161616;
}

/* глаз (показать/скрыть пароль) */

.a4-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    padding: 0;
    color: var(--a4-muted);
    cursor: pointer;
    transition: color .15s ease;
}

.a4-eye:hover { color: var(--a4-text); }

.a4-eye svg { width: 23px; height: 23px; }

/* ---------- Забыли пароль ---------- */

.a4-forgot {
    display: block;
    margin: 1rem 2px 0 auto;
    width: fit-content;
    color: var(--a4-muted);
    font-size: .98rem;
    text-decoration: none;
    transition: color .15s ease;
}

.a4-forgot:hover { color: var(--a4-text); }

/* ---------- Кнопка ---------- */

.a4-submit {
    width: 100%;
    height: 58px;
    margin-top: 2rem;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: #111111;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s ease, transform .15s ease;
}

.a4-submit:hover:not(:disabled) { opacity: .9; }
.a4-submit:active:not(:disabled) { transform: scale(.985); }
.a4-submit:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Соглашение (чекбокс на регистрации) ---------- */

.a4-terms {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin: 1.35rem 0 0;
    font-size: .92rem;
    line-height: 1.5;
    color: var(--a4-muted);
    -webkit-user-select: none;
    user-select: none;
}

.a4-terms input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--a4-accent);
    cursor: pointer;
}

.a4-terms button.link,
.a4-note button.link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--a4-blue);
    cursor: pointer;
    text-underline-offset: 3px;
}

.a4-terms button.link:hover,
.a4-note button.link:hover { text-decoration: underline; }

/* ---------- Строка согласия на входе (без чекбокса) ---------- */

.a4-note {
    margin: 1.15rem 0 0;
    text-align: center;
    font-size: .88rem;
    line-height: 1.55;
    color: #8a8a93;
}

/* ---------- Нижний переключатель ---------- */

.a4-switch {
    margin: auto 0 0;
    padding-top: 2.2rem;
    text-align: center;
    color: var(--a4-muted);
    font-size: 1rem;
}

.a4-switch a {
    color: var(--a4-blue);
    font-weight: 500;
    text-decoration: none;
    text-underline-offset: 3px;
}

.a4-switch a:hover { text-decoration: underline; }

.a4-home {
    margin: 1.1rem 0 0;
    text-align: center;
}

.a4-home a {
    color: #7a7a83;
    font-size: .85rem;
    text-decoration: none;
}

.a4-home a:hover { color: var(--a4-text); }

/* ---------- Ошибка ---------- */

.a4-error {
    margin: 1.1rem 0 0;
    color: #ff7a7a;
    font-size: .92rem;
    line-height: 1.5;
    display: none;
}

.a4-error.is-visible { display: block; }

/* ---------- Десктоп: центрируем колонку по вертикали ---------- */

@media (min-width: 700px) {
    /* v42: контент — по СЕРЕДИНЕ страницы (а не прижат к верху).
       shell обнимает контент, авто-отступы центрируют; при переполнении
       отступы схлопываются в 0 — ничего не обрезается */
    body.auth-page { justify-content: center; padding-top: 32px; padding-bottom: 32px; }
    .auth-shell { flex: 0 0 auto; margin: auto 0; }
    .a4-brand { margin: 0 0 22px; }
    .a4-brand img { height: 34px; }

    /* v41: на ПК страница входа/регистрации заметно компактнее —
       меньше вертикальных отступов, ниже поля, крупнее плотность */
    .a4-head { margin-top: 1.5rem; }
    .a4-head h1 { font-size: 1.9rem; }
    .a4-head p { margin-top: .4rem; font-size: .98rem; }
    .a4-group { margin-top: 1.1rem; }
    .a4-group + .a4-group { margin-top: .8rem; }
    .a4-label { font-size: .88rem; margin-bottom: .4rem; }
    .a4-field input { height: 50px; padding: 0 48px 0 16px; font-size: .96rem; border-radius: 13px; }
    .a4-eye { width: 40px; height: 40px; }
    .a4-eye svg { width: 20px; height: 20px; }
    .a4-forgot { margin-top: .7rem; font-size: .88rem; }
    .a4-submit { height: 48px; margin-top: 1.3rem; font-size: .98rem; }
    .a4-terms { margin-top: .95rem; font-size: .86rem; }
    .a4-note { margin-top: .85rem; font-size: .84rem; }
    .a4-switch { padding-top: 1.3rem; font-size: .92rem; }
    .a4-home { margin-top: .8rem; }
}

/* ---------- Модал документов (совместим с auth-page.js: .auth-modal / .is-open) ---------- */

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 14px calc(20px + env(safe-area-inset-bottom));
    visibility: hidden;
    opacity: 0;
    transition: opacity .22s ease, visibility .22s ease;
}

.auth-modal.is-open { visibility: visible; opacity: 1; }

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .78);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.auth-modal-panel {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: min(84dvh, 760px);
    display: flex;
    flex-direction: column;
    background: #141414;
    border: 1px solid #262626;
    border-radius: 20px;
    box-shadow: 0 40px 110px -30px rgba(0, 0, 0, .9);
    transform: translateY(14px) scale(.985);
    transition: transform .22s ease;
}

.auth-modal.is-open .auth-modal-panel { transform: translateY(0) scale(1); }

.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.3rem;
    border-bottom: 1px solid #262626;
}

.auth-modal-header h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.auth-modal-close {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
    border: 0;
    border-radius: 50%;
    color: #cfcfcf;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

.auth-modal-close:hover { background: #262626; color: #fff; }

.auth-modal-body {
    padding: 1.2rem 1.3rem;
    overflow-y: auto;
    color: #d7d7d7;
    font-size: .93rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.auth-modal-footer {
    padding: .9rem 1.3rem;
    border-top: 1px solid #262626;
    display: flex;
    justify-content: flex-end;
}

.auth-modal-footer button {
    padding: .6rem 1.3rem;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: #111111;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
}

.auth-modal-footer button:hover { opacity: .9; }

body.auth-modal-open { overflow: hidden; }
