/* JFun Gaming UI - Login + Register (users/login.php, users/register.php, body.jg-auth).
   Loaded after the page CSS and jfun-game.css. Every rule is scoped under html body.jg-auth.
   Always dark ($PWA_FORCE_DARK = true). Nothing is fixed over the form, so the page just scrolls when the keyboard is open. */

/* ---------- page shell ---------- */
html body.jg-auth {
  background: var(--jf-page-bg);
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(76px + env(safe-area-inset-top, 0px)) 16px calc(96px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}
html body.jg-auth .auth-container {
  width: 100%; max-width: 420px; margin: 0 auto; padding: 20px; border-radius: 22px;
  background: var(--jf-solid); border: 1px solid var(--border-color); box-shadow: var(--jg-glow);
  -webkit-backdrop-filter: none; backdrop-filter: none; overflow: visible; min-width: 0;
}

/* ---------- top bar (login navbar / register back link): scrolls with the page ---------- */
html body.jg-auth .navbar,
html body.jg-auth .back-link { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 100; }
html body.jg-auth .navbar {
  width: calc(100% - 32px); max-width: 420px; border-radius: 16px;
  border: 1px solid var(--border-color);
}
html body.jg-auth .navbar .logo {
  font: 700 14px var(--jg-font-display);
  letter-spacing: 0.04em; text-transform: uppercase;
}
html body.jg-auth .navbar .logo:hover { transform: none; background: var(--jf-grad); }
html body.jg-auth .navbar .user-info .balance-display,
html body.jg-auth .navbar .user-info .balance-display:hover {
  min-height: 44px; padding: 0 14px; border-radius: 999px; cursor: default;
  background: linear-gradient(var(--jf-solid), var(--jf-solid)) padding-box, var(--jf-grad) border-box;
  border: 1.5px solid transparent;
}
html body.jg-auth .navbar .user-info .balance-display .balance-text { font-family: var(--jg-font-display); font-size: 16px; font-weight: 700; color: var(--text-color); }
html body.jg-auth .navbar .user-info .balance-display .currency-text { background: var(--jf-grad-soft); color: var(--text-color); font-family: var(--jg-font-display); font-weight: 700; }
html body.jg-auth .currency-option { min-height: 44px; display: flex; align-items: center; font-size: 14px; }
html body.jg-auth .currency-option:hover,
html body.jg-auth .currency-option.active { background: var(--jf-grad-soft); color: var(--text-color); }
html body.jg-auth .back-link {
  left: 16px; min-height: 44px; padding: 0 16px; border-radius: 14px; font: 700 14px var(--jg-font-display);
  letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--jf-solid); color: var(--text-color); border: 1px solid var(--border-color); box-shadow: none;
}
html body.jg-auth .back-link:hover { transform: none; background: var(--jf-solid); box-shadow: none; }
html body.jg-auth .back-link i { color: var(--jf-pink); }

/* ---------- logo + titles ---------- */
html body.jg-auth .logo-section { margin-bottom: 18px; }
html body.jg-auth .logo-section .jf-logo {
  width: 84px; height: 84px; margin: 0 auto 12px; filter: drop-shadow(0 0 14px rgba(242, 2, 137, 0.55));
}
html body.jg-auth .logo-text {
  font: 700 28px/1.1 var(--jg-font-display); letter-spacing: 0.04em; text-shadow: 0 0 14px rgba(242, 2, 137, 0.55);
  overflow-wrap: anywhere;
}
html body.jg-auth .logo-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 6px; overflow-wrap: anywhere; }
html body.jg-auth .section-title {
  margin-bottom: 18px; padding: 12px; border-radius: 14px; background: var(--jf-grad-soft);
  border: 1px solid var(--border-color); font: 700 18px var(--jg-font-display); letter-spacing: 0.06em; text-transform: uppercase;
}
html body.jg-auth .section-title i { color: var(--jf-pink); font-size: 18px; }

/* ---------- messages: left 4px accent, 13px ---------- */
html body.jg-auth .alert { margin-bottom: 16px; overflow-wrap: anywhere; animation: none; }
html body.jg-auth .alert i { font-size: 16px; }
html body.jg-auth .alert-error { background: rgba(255, 77, 109, 0.16); border-color: rgba(255, 77, 109, 0.35); color: var(--jg-bad); }
html body.jg-auth .alert-error::before { background: var(--jg-bad); }
html body.jg-auth .alert-success { background: rgba(47, 191, 139, 0.16); border-color: rgba(47, 191, 139, 0.35); color: var(--jg-ok); }
html body.jg-auth .alert-success::before { background: var(--jg-ok); }

/* ---------- fields (register's referral field looks the same) ---------- */
html body.jg-auth .input-group { margin-bottom: 16px; }
html body.jg-auth .input-icon { left: 16px; font-size: 16px; pointer-events: none; }
html body.jg-auth .input-icon[style*="color"] { color: var(--jf-pink) !important; }
html body.jg-auth .auth-input,
html body.jg-auth .refer-input {
  min-height: 52px; height: 52px; padding: 0 14px 0 46px; font-size: 16px; border-radius: 14px;
  background: var(--jf-solid); color: var(--text-color); border: 1.5px solid var(--border-color);
}
html body.jg-auth .auth-input::placeholder,
html body.jg-auth .refer-input::placeholder { color: var(--text-secondary); opacity: 0.85; }
html body.jg-auth .auth-input:focus,
html body.jg-auth .refer-input:focus { outline: none; border-color: var(--jf-pink); background: var(--jf-solid); box-shadow: 0 0 0 3px rgba(242, 2, 137, 0.30); }
/* show/hide password buttons: none exist today; if one is ever added it gets a 44px hit area */
html body.jg-auth .input-group button { min-width: 44px; min-height: 44px; }

/* register helpers */
html body.jg-auth .username-preview {
  padding: 10px 12px 10px 14px; border-radius: 12px; font-size: 13px; font-style: normal; overflow-wrap: anywhere;
  color: var(--jg-ok); background: rgba(47, 191, 139, 0.16); border-left: 4px solid var(--jg-ok);
}
html body.jg-auth .username-preview i { color: var(--jg-ok); }
html body.jg-auth .username-hint { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
html body.jg-auth .username-hint i { color: var(--jf-pink); }
html body.jg-auth .password-strength { background: var(--border-color); }
html body.jg-auth .strength-weak { background: var(--jg-bad); }
html body.jg-auth .strength-medium { background: var(--jg-warn); }
html body.jg-auth .strength-strong { background: var(--jg-ok); }
html body.jg-auth .refer-section {
  padding: 14px 14px 14px 18px; margin-bottom: 20px; border-radius: 14px;
  background: var(--jf-grad-soft); border: 1px solid var(--border-color);
}
html body.jg-auth .refer-section::before { width: 4px; background: var(--jf-grad); }
html body.jg-auth .refer-label { font: 600 12px var(--jg-font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 10px; overflow-wrap: anywhere; }
html body.jg-auth .refer-label i { color: var(--jf-pink); font-size: 16px; }
html body.jg-auth .hidden-refer {
  padding: 14px 14px 14px 18px; margin-bottom: 20px; border-radius: 14px;
  background: rgba(47, 191, 139, 0.16); border: 1px solid rgba(47, 191, 139, 0.35);
}
html body.jg-auth .hidden-refer::before { width: 4px; background: var(--jg-ok); }
html body.jg-auth .hidden-refer-text { font-size: 14px; color: var(--jg-ok); overflow-wrap: anywhere; }
html body.jg-auth .hidden-refer-text i { color: var(--jg-ok); }

/* ---------- remember / forgot ---------- */
html body.jg-auth .remember-group { margin-bottom: 18px; gap: 8px 12px; flex-wrap: wrap; }
html body.jg-auth .remember-label { min-height: 44px; font-size: 13px; color: var(--text-secondary); }
html body.jg-auth .remember-label input[type="checkbox"] { width: 22px; height: 22px; }
html body.jg-auth .forgot-link,
html body.jg-auth .forgot-link:hover {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
  color: var(--jf-pink); font-size: 14px; text-decoration: none;
}
@media (max-width: 480px) {
  html body.jg-auth .remember-group { flex-direction: row; align-items: center; }
}

/* ---------- primary button ---------- */
html body.jg-auth .auth-btn {
  width: 100%; min-height: 52px; height: 52px; border-radius: 14px; gap: 8px;
  font: 700 16px var(--jg-font-display); letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--jf-grad); color: #fff; box-shadow: var(--jg-glow); touch-action: manipulation;
}
html body.jg-auth .auth-btn::before { display: none; }
html body.jg-auth .auth-btn:hover { transform: none; box-shadow: var(--jg-glow); }
html body.jg-auth .auth-btn:active { transform: scale(0.97); }
html body.jg-auth .auth-btn.loading { opacity: 0.85; }

/* ---------- divider + social ---------- */
html body.jg-auth .divider { margin: 20px 0; color: var(--text-secondary); }
html body.jg-auth .divider::before,
html body.jg-auth .divider::after { background: var(--border-color); }
html body.jg-auth .divider span { color: var(--text-secondary); font-family: var(--jg-font-display); letter-spacing: 0.08em; }
html body.jg-auth .social-login { gap: 12px; margin-bottom: 16px; }
html body.jg-auth .social-btn {
  width: 52px; height: 52px; min-width: 44px; min-height: 44px; border-radius: 14px;
  background: var(--jf-solid); border: 1.5px solid var(--border-color); color: var(--text-color); box-shadow: none;
}
html body.jg-auth .social-btn:hover { transform: none; box-shadow: none; border-color: var(--border-color); color: var(--text-color); }
html body.jg-auth .social-btn:active { transform: scale(0.97); }

/* ---------- secondary links ---------- */
html body.jg-auth .auth-links { padding-top: 14px; font-size: 14px; color: var(--text-secondary); border-top-color: var(--border-color); }
html body.jg-auth .auth-links a,
html body.jg-auth .auth-links a:hover {
  min-height: 44px; padding: 0 12px; justify-content: center; color: var(--jf-pink); background: transparent; border-radius: 12px;
}

/* ---------- install prompt: stays clear of the button (page has 96px bottom room) ---------- */
html body.jg-auth .jf-install { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html body.jg-auth .auth-container,
  html body.jg-auth .password-strength.show,
  html body.jg-auth .ripple,
  html body.jg-auth .auth-btn .spinner { animation: none; }
  html body.jg-auth .ripple { display: none; }
}
