/* ===== Mobile Auth Bottom-Sheet Modal (v4.9.3) ===== */

/* Desktop: hidden entirely */
@media (min-width: 1025px) {
  .mam { display: none !important; }
}

/* ── Mobile + Tablet ≤1024px ───────────────────────────────────────── */
@media (max-width: 1024px) {

  /* Backdrop */
  .mam {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10005;
    background: rgba(10, 14, 26, 0.85);
    align-items: flex-end;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  .mam.open {
    display: flex;
  }

  /* Sheet */
  .mam__sheet {
    position: relative;
    width: 100%;
    max-height: 92vh;
    background: var(--bg-card, #14172b);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    animation: mamSlideUp 0.3s ease-out;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
  }
  @keyframes mamSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Handle */
  .mam__handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }

  /* Header */
  .mam__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem 0.5rem;
    flex-shrink: 0;
  }
  .mam__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary, #fff);
  }
  .mam__brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  .mam__close {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
  }
  .mam__close:active {
    background: rgba(255, 255, 255, 0.1);
  }
  .mam__close svg {
    stroke: rgba(255, 255, 255, 0.55);
  }

  /* Tabs */
  .mam__tabs {
    display: flex;
    gap: 0;
    padding: 0 1.25rem;
    flex-shrink: 0;
  }
  .mam__tab {
    all: unset;
    flex: 1;
    text-align: center;
    padding: 0.65rem 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
  }
  .mam__tab.active {
    color: #a78bfa;
    border-bottom-color: #8b5cf6;
  }

  /* Body (scrollable) */
  .mam__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1rem 1.25rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 1.25rem));
    -webkit-overflow-scrolling: touch;
  }

  /* Title / Subtitle */
  .mam__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0 0 0.25rem;
  }
  .mam__subtitle {
    font-size: 0.85rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    margin: 0 0 1rem;
    line-height: 1.4;
  }

  /* Forms */
  .mam__form {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .mam__form.hidden {
    display: none;
  }
  .mam__form .form-group {
    margin-bottom: 0.85rem;
  }
  .mam__form .form-label {
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
  }
  .mam__form .form-input {
    font-size: 1rem;
    padding: 0.7rem 0.85rem;
  }
  .mam__submit {
    margin-top: 0.25rem;
    width: 100%;
  }

  /* Forgot link */
  .mam__forgot-link {
    text-align: right;
    margin-bottom: 0.5rem;
  }
  .mam__forgot-link a {
    font-size: 0.82rem;
    color: #a78bfa;
    text-decoration: none;
  }
  .mam__forgot-link a:active {
    color: #c4b5fd;
  }

  /* Alerts */
  .mam .login-alert {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.82rem;
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
  }
  .mam .login-alert.hidden {
    display: none;
  }
  .mam .login-alert.login-success {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.2);
  }

  /* 2FA code inputs */
  .mam .twofa-login-step {
    text-align: center;
    margin-bottom: 1rem;
  }
  .mam .twofa-login-icon {
    font-size: 2rem;
    color: #a78bfa;
    margin-bottom: 0.5rem;
  }
  .mam .twofa-login-step h3 {
    font-size: 1.1rem;
    color: var(--text-primary, #fff);
    margin: 0 0 0.3rem;
  }
  .mam .twofa-login-step p {
    font-size: 0.85rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    margin: 0;
  }
  .mam .twofa-code-input {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
  }
  .mam .twofa-code-input input {
    width: 42px;
    height: 48px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #fff);
    outline: none;
    transition: border-color 0.2s;
  }
  .mam .twofa-code-input input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
  }

  /* Social login */
  .mam__social {
    margin-top: 1rem;
    padding-top: 0.75rem;
  }
  .mam__social.hidden {
    display: none;
  }
  .mam__social .btn-steam {
    width: 100%;
    margin-bottom: 0.75rem;
  }
  .mam__social .btn-steam img {
    width: 18px;
    height: 18px;
  }
  .mam__social .social-login-separator {
    text-align: center;
    margin: 0.75rem 0;
    color: var(--text-muted, rgba(255, 255, 255, 0.4));
    font-size: 0.8rem;
    position: relative;
  }
  .mam__social .social-login-separator::before,
  .mam__social .social-login-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
  }
  .mam__social .social-login-separator::before { left: 0; }
  .mam__social .social-login-separator::after  { right: 0; }

  .mam__social .social-login-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .mam__social .btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.5rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary, #fff);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
  }
  .mam__social .btn-social:active {
    background: rgba(255, 255, 255, 0.08);
  }
  .mam__social .btn-social i {
    font-size: 1rem;
  }
  .mam__social .btn-google i  { color: #ea4335; }
  .mam__social .btn-facebook i { color: #1877f2; }
  .mam__social .btn-twitter i  { color: #fff; }
  .mam__social .btn-tiktok i   { color: #ff0050; }

  /* Checkboxes */
  .mam .form-checkbox-group {
    margin-bottom: 0.65rem;
  }
  .mam .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.55));
    line-height: 1.4;
    cursor: pointer;
  }
  .mam .checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #8b5cf6;
  }
  .mam .checkbox-label a {
    color: #a78bfa;
    text-decoration: none;
  }

  /* Referral toggle */
  .mam .referral-toggle-btn {
    all: unset;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #a78bfa;
    cursor: pointer;
    padding: 0.3rem 0;
  }
  .mam .referral-toggle-btn .referral-chevron {
    transition: transform 0.2s;
    font-size: 0.7rem;
  }
  .mam .referral-toggle-btn .referral-chevron.open {
    transform: rotate(180deg);
  }
  .mam .referral-input-wrapper {
    margin-top: 0.4rem;
  }
  .mam .referral-input-wrapper.hidden {
    display: none;
  }

  /* Footer links */
  .mam__footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    text-align: center;
  }
  .mam__footer p {
    margin: 0.3rem 0;
    font-size: 0.85rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
  }
  .mam__footer p.hidden {
    display: none;
  }
  .mam__footer a {
    color: #a78bfa;
    text-decoration: none;
    font-weight: 600;
  }
  .mam__footer a:active {
    color: #c4b5fd;
  }

  /* ── Light theme overrides ────────────────────────────────────────── */
  [data-theme="light"] .mam {
    background: rgba(0, 0, 0, 0.45);
  }
  [data-theme="light"] .mam__sheet {
    background: var(--bg-card, #fff);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
  }
  [data-theme="light"] .mam__handle {
    background: rgba(0, 0, 0, 0.15);
  }
  [data-theme="light"] .mam__close svg {
    stroke: rgba(0, 0, 0, 0.45);
  }
  [data-theme="light"] .mam__tab {
    color: rgba(0, 0, 0, 0.4);
  }
  [data-theme="light"] .mam__tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
  }
  [data-theme="light"] .mam .twofa-code-input input {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary, #1a1a2e);
  }
  [data-theme="light"] .mam .twofa-code-input input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
  }
  [data-theme="light"] .mam__social .btn-social {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
  }
  [data-theme="light"] .mam__social .btn-social:active {
    background: rgba(0, 0, 0, 0.05);
  }
  [data-theme="light"] .mam__social .social-login-separator::before,
  [data-theme="light"] .mam__social .social-login-separator::after {
    background: rgba(0, 0, 0, 0.1);
  }
  [data-theme="light"] .mam__footer {
    border-top-color: rgba(0, 0, 0, 0.07);
  }
  [data-theme="light"] .mam .login-alert {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
  }
  [data-theme="light"] .mam .login-alert.login-success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.15);
  }

} /* end @media (max-width: 1024px) */
