.auth-modal { display: none; position: fixed; inset: 0; z-index: 300; align-items: center; justify-content: center; padding: 20px; }
.auth-modal.open { display: flex; }
.auth-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.75); }
.auth-card { position: relative; width: 100%; max-width: 420px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.45); }
.auth-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-subtle); background: var(--bg-input); border: 1px solid var(--border); transition: all 0.15s; }
.auth-close:hover { color: var(--text); background: var(--bg-hover); }
.auth-close [data-lucide] { width: 16px; height: 16px; }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo .site-logo { justify-self: center; font-size: 26px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-tab { padding: 10px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-muted); transition: all 0.15s; }
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.active { display: flex; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.auth-input-wrap { display: flex; align-items: center; gap: 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; height: 46px; transition: border-color 0.2s, box-shadow 0.2s; }
.auth-input-wrap:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-bg); }
.auth-input-wrap [data-lucide] { width: 16px; height: 16px; color: var(--text-subtle); }
.auth-input-wrap input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font-size: 14px; font-family: inherit; }
.auth-input-wrap input::placeholder { color: var(--text-faint); }
.toggle-password { color: var(--text-subtle); display: flex; align-items: center; transition: color 0.15s; }
.toggle-password:hover { color: var(--text); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.auth-check { display: flex; align-items: center; gap: 8px; color: var(--text-muted); cursor: pointer; }
.auth-check input { accent-color: var(--accent); width: 14px; height: 14px; }
.auth-check-block { line-height: 1.5; }
.auth-link { color: var(--accent); font-weight: 500; }
.auth-link:hover { text-decoration: underline; }
.auth-error { display: none; padding: 10px 12px; border-radius: 10px; background: rgba(251,113,133,0.1); border: 1px solid rgba(251,113,133,0.25); color: var(--red); font-size: 13px; font-weight: 500; line-height: 1.4; }
.auth-error:not(:empty) { display: block; }
.auth-submit { width: 100%; padding: 12px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; transition: background 0.15s, transform 0.1s; }
.auth-submit:hover { background: var(--accent-hover); }
.auth-submit:active { transform: scale(0.99); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-subtle); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-socials { display: grid; grid-template-columns: 1fr; gap: 10px; }
.auth-socials .tg-auth-button { width: 100% !important; box-sizing: border-box; display: flex !important; align-items: center; justify-content: center; text-align: center; border-radius: 10px !important; font-family: inherit !important; font-size: 15px !important; font-weight: 700 !important; }
.auth-social { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 13px; font-weight: 600; transition: all 0.15s; }
.auth-social:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.auth-social [data-lucide] { width: 16px; height: 16px; }
@media (max-width: 480px) {
  .auth-card { padding: 22px; border-radius: 14px; }
  .auth-logo { margin-bottom: 14px; }
  .auth-logo .site-logo { font-size: 22px; }
  .auth-close { top: 10px; right: 10px; }
  .auth-socials { grid-template-columns: 1fr; }
}

.auth-username-status { display: flex; align-items: center; gap: 6px; min-height: 18px; margin-top: 6px; font-size: 12px; color: var(--text-subtle); }
.auth-username-status.ok { color: #34c77b; }
.auth-username-status.taken { color: #e5484d; }
.auth-username-status.loading::before { content: ''; width: 12px; height: 12px; flex: 0 0 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: auth-spin 0.7s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-step-title { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; text-align: center; }
.auth-step-sub { font-size: 13px; color: var(--text-subtle); margin: -8px 0 4px; text-align: center; }
.auth-submit:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Banned email provider ────────────────────────────────────────────────── */
/* red state for inputs whose domain is on the blocklist (signup + forced) */
.auth-input-wrap.invalid { border-color: var(--red); }
.auth-input-wrap.invalid:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(251,113,133,0.14); }
.auth-input-wrap.invalid [data-lucide] { color: var(--red); }

/* forced email-change modal: rendered server-side with .open, no close
   control, above everything (popups live at z-index 300 like auth) */
.auth-modal.forced { z-index: 500; align-items: flex-start; overflow-y: auto; }
.auth-modal.forced .auth-modal-backdrop { background: rgba(6,6,9,0.94); }
.auth-modal.forced .auth-card { max-width: 440px; margin: auto; max-height: none; }
.auth-modal.forced .auth-step-sub { margin: 8px 0 4px; line-height: 1.55; }
.auth-modal.forced .auth-form { margin-top: 4px; }
.auth-forced-icon { width: 54px; height: 54px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: rgba(251,113,133,0.1); border: 1px solid rgba(251,113,133,0.28); color: var(--red); }
.auth-forced-icon [data-lucide] { width: 26px; height: 26px; }
.auth-forced-current { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 4px 0 18px; font-size: 12.5px; color: var(--text-subtle); }
.auth-forced-current [data-lucide] { width: 14px; height: 14px; flex: 0 0 14px; }
.auth-forced-current b { color: var(--text-muted); font-weight: 600; word-break: break-all; }

/* page behind the forced modal is inert */
body.email-change-required { overflow: hidden; }

@media (max-width: 480px) {
  .auth-modal.forced { padding: 14px; }
  .auth-modal.forced .auth-card { padding: 22px; border-radius: 14px; }
  .auth-forced-icon { width: 46px; height: 46px; margin-bottom: 12px; }
  .auth-forced-icon [data-lucide] { width: 22px; height: 22px; }
  .auth-forced-current { flex-wrap: wrap; }
}
