/* Outer rounded shell and separate inner scroller. */
#auth-modal:not(.hidden) { padding: 12px; align-items: center; }
#auth-modal:not(.hidden) > .relative {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 24px !important;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    width: 100%;
    max-width: 448px;
}
#auth-modal #auth-state-register,
#auth-modal #auth-state-login {
    min-width: 0;
    border-radius: inherit;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 24px 32px;
    scrollbar-width: thin;
    scrollbar-color: #a4aab5 transparent;
}
#auth-modal > .relative > button[aria-label] {
    position: absolute !important;
    top: 16px !important;
    right: 16px;
    z-index: 20;
}
#auth-modal input, #auth-modal button { max-width: 100%; min-width: 0; }
#auth-modal .grid.grid-cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
#auth-modal .captcha-cell { min-width: 0; overflow: hidden; aspect-ratio: 1; }
#auth-modal .captcha-cell img { display: block; width: 70%; height: 70%; max-width: 72px; max-height: 72px; object-fit: contain; pointer-events: none; }
#auth-modal .captcha-cell:focus-visible { outline: 3px solid #c58a2b; outline-offset: 2px; }
#auth-modal .gender-btn[data-gender="female"].selected { border-color: #db2777 !important; background: #fce7f3 !important; color: #9d174d !important; }
#auth-modal .gender-btn[data-gender="female"].selected i { color: inherit !important; }
#auth-modal .gender-btn[data-gender="female"] i { color: #db2777 !important; }

/* Сброс пароля — отдельные отступы, чтобы экран не "расползался" */
#auth-modal .auth-reset-pad { padding: 18px 4px 4px; }
#auth-modal .auth-reset-head { display: flex; flex-direction: column; align-items: center; }
#auth-modal .auth-reset-icon {
    width: 64px;
    height: 64px;
    border-radius: 9999px;
    background: var(--dm-primary-tint, rgba(24, 90, 131, 0.10));
    color: var(--dm-primary, #185a83);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0 12px;
}
#auth-modal .auth-reset-icon i { font-size: 28px; line-height: 1; }
#auth-modal .auth-reset-head h2 { line-height: 1.2; margin: 0; }
#auth-modal .auth-reset-head p { line-height: 1.4; max-width: 280px; margin: 4px auto 0; }
#auth-modal #auth-state-reset-request,
#auth-modal #auth-state-reset-confirm { max-width: 360px; margin: 0 auto; }
#auth-modal #auth-state-reset-request form,
#auth-modal #auth-state-reset-confirm form { display: flex; flex-direction: column; gap: 8px; }
#auth-modal #auth-state-reset-request label,
#auth-modal #auth-state-reset-confirm label { margin: 0; padding-top: 2px; }
#auth-modal #auth-state-reset-request input,
#auth-modal #auth-state-reset-confirm input { width: 100%; min-width: 0; }
#auth-modal #auth-state-reset-request button[type="submit"],
#auth-modal #auth-state-reset-confirm button[type="submit"] { width: 100%; }
@media (max-width: 360px) {
    #auth-modal .auth-reset-pad { padding: 14px 2px 0; }
    #auth-modal .auth-reset-head h2 { font-size: 16px; }
}
.dark #auth-modal .gender-btn[data-gender="female"].selected { border-color: #f472b6 !important; background: #502038 !important; color: #fbcfe8 !important; }
@media(max-width:639px) {
    #auth-modal:not(.hidden) { padding: 8px; }
    #auth-modal:not(.hidden) > .relative,
    #auth-modal #auth-state-register,
    #auth-modal #auth-state-login { max-height: calc(100dvh - 16px); }
    #auth-modal #auth-state-register,
    #auth-modal #auth-state-login { padding: 24px 16px max(20px,env(safe-area-inset-bottom)); }
    #auth-modal input { font-size: 16px; }
    #auth-modal .gender-btn { padding: 10px 3px; gap: 3px; font-size: 12px; flex-wrap: wrap; }
    #auth-reg-slug { padding-left: 12px; padding-right: 12px; }
    #auth-reg-slug + #auth-slug-status { position: static; display: block; transform: none; min-height: 20px; }
    #auth-register-form .relative > span:first-child { position: static; display: block; transform: none; margin-bottom: 4px; }
}

/* === 152-ФЗ: чекбокс согласия и блок ошибки === */
#auth-modal .auth-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 6px;
    padding: 12px 12px;
    border-radius: 12px;
    background: rgba(24, 90, 131, 0.06);
    border: 1px solid rgba(24, 90, 131, 0.18);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#auth-modal .auth-consent-row {
    background: rgba(125, 175, 207, 0.08);
    border-color: rgba(125, 175, 207, 0.22);
}

#auth-modal .auth-consent-row:hover { border-color: var(--dm-primary, #185a83); }

#auth-modal .auth-consent-input {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    margin: 2px 0 0 0;
    flex-shrink: 0;
    border: 2px solid #b6c2cd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

#auth-modal .auth-consent-input:checked {
    background: var(--dm-primary, #185a83);
    border-color: var(--dm-primary, #185a83);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3 3 7-7'/></svg>");
    background-size: 14px 14px;
    background-position: center;
    background-repeat: no-repeat;
}

#auth-modal .auth-consent-input:focus-visible {
    outline: 2px solid var(--dm-primary, #185a83);
    outline-offset: 2px;
}

#auth-modal .auth-consent-text {
    font-size: 12px;
    line-height: 1.45;
    color: oklch(35% 0.02 250);
}

#auth-modal .auth-consent-text { color: oklch(85% 0.02 250); }

#auth-modal .auth-consent-link {
    color: var(--dm-primary, #185a83);
    text-decoration: underline;
    font-weight: 600;
}

#auth-modal .auth-consent-link:hover { text-decoration: none; }

#auth-modal .auth-consent-required {
    background: rgba(185, 65, 65, 0.08);
    color: #b94141;
    border-left: 3px solid #b94141;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
}

#auth-modal .auth-consent-required { color: #fca5a5; }
