/* Auth popup (login / register / forgot / 2FA).
   Self-contained: public pages do not load styles.css, so every rule is
   scoped under .hb-auth-* and nothing here leaks into the host page. */
.hb-auth-overlay {
  position: fixed;
  inset: 0;
  /* Google renders the reCAPTCHA challenge (the image grid) in its own
     top-level fixed div at z-index 2000000000. Stay just below that so the
     challenge shows on top of this overlay; the highest z-index the site
     itself uses is 999999, so the popup still covers the page. */
  z-index: 1999999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.hb-auth-overlay.hb-open {
  opacity: 1;
  visibility: visible;
}

body.hb-auth-lock {
  overflow: hidden;
}

.hb-auth-dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 30px;
  border-radius: 20px;
  background: #1a1a1a;
  color: #fff;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.2s ease;
  /* Pin the base typography. /play loads the game stylesheet, which sets
     html/body to 20px with a different line-height; without this the popup
     would inherit that and render larger and tighter than on /index. */
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  /* /play loads the game stylesheet, which sets html/body to font-weight 300
     with grayscale antialiasing; /index uses the browser defaults (400,
     subpixel). Both are inherited, so pin them here or the popup text looks
     lighter and thinner on /play than on /index. */
  font-weight: 400;
  -webkit-font-smoothing: auto;
  -webkit-overflow-scrolling: touch;
}

.hb-auth-overlay.hb-open .hb-auth-dialog {
  transform: none;
}

.hb-auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #888;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.hb-auth-close:hover,
.hb-auth-close:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.hb-auth-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
}

.hb-auth-step[hidden] {
  display: none;
}

.hb-auth-title {
  margin: 0 0 6px;
  text-align: center;
  color: #00ffcc;
  text-shadow: 0 0 10px #00ffcc;
  /* The game stylesheet's reset sets h2 to font: inherit, which drops the
     browser's bold default; restore it so the heading matches /index. */
  font-weight: 700;
  /* Same 22.4px-28.8px range as 1.4rem-1.8rem at a 16px root, but expressed in
     px so the game page's 20px root cannot enlarge it. */
  font-size: clamp(22.4px, 4vw, 28.8px);
}

.hb-auth-sub {
  margin: -6px 0 4px;
  text-align: center;
  color: #bbb;
  font-size: 14px;
  line-height: 1.4;
}

.hb-auth-group {
  display: flex;
  flex-direction: column;
}

.hb-auth-group label {
  margin-bottom: 6px;
  font-size: 13px;
  color: #bbb;
  font-weight: 500;
}

.hb-auth-group input[type='text'],
.hb-auth-group input[type='password'],
.hb-auth-group input[type='email'] {
  width: 100%;
  padding: 12px 10px;
  border: none;
  border-radius: 10px;
  background: #2b2b2b;
  color: #fff;
  box-shadow: inset 2px 2px 5px #0d0d0d, inset -2px -2px 5px #333;
  transition: all 0.3s ease;
  font-size: 15px;
  min-height: 42px;
  font-family: inherit;
}

.hb-auth-group input::placeholder {
  color: #888;
}

.hb-auth-group input:focus {
  outline: none;
  box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc;
  transform: translateY(-1px);
}

/* Collapsible referral-code row in the register step: same neumorphic look as
   the inputs, with a chevron that flips when the field is revealed. */
.hb-auth-referral {
  display: flex;
  flex-direction: column;
}

.hb-auth-referral-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 12px 10px;
  border: none;
  border-radius: 10px;
  background: #2b2b2b;
  color: #bbb;
  box-shadow: inset 2px 2px 5px #0d0d0d, inset -2px -2px 5px #333;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* While collapsed the row is a plain row: no hover or focus highlight, so it
   never lights up until the field is actually revealed. */
.hb-auth-referral:not(.is-open) .hb-auth-referral-toggle:hover,
.hb-auth-referral:not(.is-open) .hb-auth-referral-toggle:focus {
  color: #bbb;
  outline: none;
  box-shadow: inset 2px 2px 5px #0d0d0d, inset -2px -2px 5px #333;
}

/* Keyboard users still get a focus cue; a mouse click does not show it. */
.hb-auth-referral:not(.is-open) .hb-auth-referral-toggle:focus-visible {
  outline: 2px solid rgba(0, 255, 204, 0.55);
  outline-offset: 2px;
}

/* Only highlight the row once it is expanded. */
.hb-auth-referral.is-open .hb-auth-referral-toggle:hover { color: #fff; }

.hb-auth-referral-toggle:focus {
  outline: none;
  box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc;
}

.hb-auth-referral-chevron {
  color: #888;
  font-size: 12px;
  transition: transform 0.25s ease;
}

.hb-auth-referral.is-open .hb-auth-referral-chevron { transform: rotate(180deg); }

.hb-auth-referral-body { margin-top: 1px; }

.hb-auth-referral-body input {
  width: 100%;
  padding: 12px 10px;
  border: none;
  border-radius: 10px;
  background: #2b2b2b;
  color: #fff;
  box-shadow: inset 2px 2px 5px #0d0d0d, inset -2px -2px 5px #333;
  transition: all 0.3s ease;
  font-size: 15px;
  min-height: 42px;
  font-family: inherit;
}

.hb-auth-referral-body input::placeholder { color: #888; }

.hb-auth-referral-body input:focus {
  outline: none;
  box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc;
  transform: translateY(-1px);
}

/* A standalone auth URL (/login, /register, /forgot-password) opened directly:
   the popup takes over, so its inline form is hidden and the visitor only sees
   the popup. Only the auth layout wraps its content in .login-container, so
   this has no effect anywhere else. */
body.hb-auth-standalone .login-container > *:not(.navbar) {
  display: none !important;
}

.hb-auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #bbb;
  cursor: pointer;
  user-select: none;
  line-height: 1.3;
  margin: 5px 0;
}

.hb-auth-checkbox input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: #00ffcc;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.hb-auth-checkbox:hover {
  color: #fff;
}

.hb-auth-checkbox a {
  color: #00ffcc;
  text-decoration: underline;
}

.hb-auth-recaptcha {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
  padding: 8px;
  border-radius: 10px;
  background: #2b2b2b;
  box-shadow: inset 2px 2px 5px #0d0d0d, inset -2px -2px 5px #333;
  min-height: 78px;
  overflow: hidden;
}

.hb-auth-recaptcha .g-recaptcha {
  transform: scale(0.85);
  transform-origin: center;
}

.hb-auth-submit {
  width: 100%;
  padding: 12px 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, #00a594, #00d4aa);
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 4px 4px 15px #0d0d0d, -4px -4px 15px #2a2a2a;
  min-height: 42px;
  margin-top: 8px;
  font-family: inherit;
}

.hb-auth-submit:hover:not(:disabled) {
  /* A quiet lift: a slightly lighter gradient and a soft glow, instead of the
     old neon flare that blew out the button. */
  background: linear-gradient(145deg, #00b8a3, #00dfb6);
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.28),
              4px 4px 15px #0d0d0d, -4px -4px 15px #2a2a2a;
  transform: translateY(-1px);
}

.hb-auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hb-auth-links {
  text-align: center;
  font-size: 12px;
  color: #777;
  margin-top: 8px;
  line-height: 1.6;
}

.hb-auth-links a {
  color: #00ffcc;
  text-decoration: none;
  cursor: pointer;
}

.hb-auth-links a:hover {
  text-decoration: underline;
}

.hb-auth-error,
.hb-auth-success {
  display: none;
  padding: 10px 16px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.hb-auth-error.hb-show {
  display: block;
}

.hb-auth-error {
  background: linear-gradient(145deg, rgba(244, 67, 54, 0.15), rgba(244, 67, 54, 0.08));
  border: 1px solid #ff5a5f;
  color: #ff5a5f;
}

.hb-auth-success {
  background: linear-gradient(145deg, rgba(0, 255, 204, 0.1), rgba(0, 255, 204, 0.05));
  border: 1px solid rgba(0, 255, 204, 0.3);
  color: #00ffcc;
}

.hb-auth-success:not([hidden]) {
  display: block;
}

/* Anything toggled with the hidden attribute inside the dialog must actually
   disappear, whatever display value the rule above set. */
.hb-auth-dialog [hidden] {
  display: none !important;
}

@media (max-width: 480px) {
  .hb-auth-overlay {
    padding: 0;
    align-items: stretch;
  }

  .hb-auth-dialog {
    max-width: none;
    max-height: none;
    min-height: 100%;
    border-radius: 0;
    padding: 24px 20px;
    transform: none;
  }
}
