/* "Log in" popup. Compact card, no inner scrollbar. The dialog sizes to its content (overflow: visible).
   Page scroll is locked while it fits. Under 560px tall the page itself may scroll; the card never grows a scrollbar. */
.al-login-modal[hidden] { display: none !important; }
.al-login-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: .5rem; overflow: visible; }
.al-login-backdrop { position: absolute; inset: 0; background: rgba(26, 11, 59, .62); }
.al-login-dialog { position: relative; width: 100%; max-width: 400px; max-height: calc(100vh - 1rem); max-height: calc(100dvh - 1rem); overflow: visible; background: #fff; border-radius: .85rem; box-shadow: 0 20px 50px rgba(26, 11, 59, .45); outline: none; }
.al-login-head { display: flex; align-items: center; justify-content: space-between; gap: .35rem; padding: .3rem .45rem .3rem .85rem; background: linear-gradient(135deg, #2e1065 0%, #4c1d95 55%, #7c3aed 100%); color: #fff; border-radius: .85rem .85rem 0 0; }
.al-login-title { margin: 0; font-family: 'Pixelify Sans', system-ui, sans-serif; font-weight: 700; font-size: 1.2rem; line-height: 1.1; letter-spacing: .02em; color: #fff; }
.al-login-close { width: 2rem; height: 2rem; padding: 0; background-size: .85rem; opacity: .9; flex: none; }
.al-login-close:hover, .al-login-close:focus-visible { opacity: 1; }
.al-login-body { padding: .55rem .8rem .6rem; overflow: visible; }
.al-login-sub { margin: 0 0 .35rem; font-size: .78rem; line-height: 1.25; color: #64748b; }
.al-login-field { margin-bottom: .4rem; }
.al-login-modal .form-label { margin-bottom: .1rem; font-size: .8rem; font-weight: 600; line-height: 1.2; color: #1a0b3b; }
.al-login-modal .form-control { min-height: 2.15rem; padding: .2rem .6rem; font-size: 16px; /* 16px: no iOS zoom on focus */ line-height: 1.25; border-color: #c4b5fd; }
.al-login-modal .form-control:focus { border-color: #7c3aed; box-shadow: 0 0 0 .15rem rgba(124, 58, 237, .25); }
.al-login-modal .form-check { min-height: 0; display: flex; align-items: center; gap: .4rem; margin: 0; padding-left: 0; }
.al-login-modal .form-check-input { float: none; margin: 0; width: 1.05rem; height: 1.05rem; flex: none; border-color: #a78bfa; }
.al-login-modal .form-check-input:checked { background-color: #7c3aed; border-color: #7c3aed; }
.al-login-modal .form-check-input:focus { box-shadow: 0 0 0 .15rem rgba(124, 58, 237, .25); }
.al-login-modal .form-check-label { padding: 0; font-size: .82rem; line-height: 1.2; cursor: pointer; }
.al-login-robot { margin-bottom: .4rem; border: 1px solid #ede9fe; background: #f5f3ff; border-radius: .55rem; padding: .35rem .5rem .3rem; }
.al-login-robot-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.al-login-robot-row > .form-check { flex: 1 1 auto; min-width: 0; }
.al-login-math { display: flex; align-items: center; gap: .35rem; flex: 0 1 11rem; }
.al-login-math .form-label { margin: 0; white-space: nowrap; }
.al-login-math .form-control { width: 3.4rem; min-height: 1.9rem; padding: .1rem .35rem; text-align: center; }
.al-login-lockout { margin: .2rem 0 0; font-size: .7rem; line-height: 1.25; color: #64748b; }
.al-login-remember-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.al-login-remember-row a { font-size: .82rem; font-weight: 600; color: #6d28d9; text-decoration: none; white-space: nowrap; }
.al-login-remember-row a:hover, .al-login-remember-row a:focus-visible { text-decoration: underline; }
.al-login-submit { min-height: 2.25rem; padding: .3rem .75rem; background: #7c3aed; border: 1px solid #6d28d9; color: #fff; font-weight: 700; border-radius: .5rem; }
.al-login-submit:hover, .al-login-submit:focus-visible { background: #6d28d9; color: #fff; }
.al-login-submit:disabled { background: #a78bfa; border-color: #a78bfa; color: #fff; opacity: 1; }
.al-login-links { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .75rem; margin-top: .35rem; }
.al-login-links a { color: #6d28d9; font-weight: 600; font-size: .82rem; line-height: 1.3; text-decoration: none; }
.al-login-links a:hover, .al-login-links a:focus-visible { text-decoration: underline; }
.al-login-links a.al-login-resend, .al-login-links a.text-muted { font-weight: 400; font-size: .75rem; }
.al-login-links a[hidden] { display: none; }
.al-login-modal :focus-visible { outline: 3px solid #a78bfa; outline-offset: 2px; }
body:has(.al-login-modal:not([hidden])) { overflow: hidden; }

@media (prefers-reduced-motion: no-preference) {
    .al-login-modal:not([hidden]) .al-login-dialog { animation: al-login-in .16s ease-out; }
    @keyframes al-login-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Narrow phones: still a card, still no inner scrollbar. */
@media (max-width: 575.98px) {
    .al-login-modal { padding: .4rem; padding-top: max(.4rem, env(safe-area-inset-top)); padding-bottom: max(.4rem, env(safe-area-inset-bottom)); }
    .al-login-dialog { max-width: none; }
    .al-login-math { flex-basis: 9.5rem; }
}

/* Very short viewports only: the page may scroll. The dialog itself stays overflow:visible. */
@media (max-height: 560px) {
    .al-login-modal { align-items: flex-start; overflow: visible; }
    .al-login-dialog { max-height: none; overflow: visible; }
    body:has(.al-login-modal:not([hidden])) { overflow: auto; }
}
