/* AUTH-2B: Member Character Space / overlay auth — mobile-first, desktop panel contract */

.mjn-member-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(15, 23, 42, 0.42);
}

.mjn-member-auth-overlay[hidden] {
  display: none !important;
}

.mjn-member-auth-sheet {
  width: min(100%, 28rem);
  max-height: min(92vh, 40rem);
  overflow: auto;
  border-radius: 1.25rem 1.25rem 0 0;
  background: #fff8f1;
  color: #1c1917;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
  padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom, 0));
}

.mjn-member-auth-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mjn-member-auth-sheet__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.mjn-member-auth-sheet__close {
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #57534e;
}

.mjn-member-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.mjn-member-auth-tabs button {
  border: 1px solid #fdba74;
  background: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.mjn-member-auth-tabs button.is-active,
.mjn-member-auth-tabs button[aria-selected="true"] {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}

.mjn-member-auth-status {
  min-height: 1.25rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: #44403c;
}

.mjn-member-auth-status[data-mjn-auth-error="1"] {
  color: #b91c1c;
}

.mjn-member-auth-form {
  display: grid;
  gap: 0.75rem;
}

.mjn-member-auth-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.mjn-member-auth-form input[type="tel"],
.mjn-member-auth-form input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d6d3d1;
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
}

.mjn-member-auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 500;
}

.mjn-member-auth-terms__ver {
  color: #78716c;
  font-weight: 500;
}

.mjn-member-auth-primary,
.mjn-member-auth-offer button {
  border: 0;
  border-radius: 0.9rem;
  background: #ea580c;
  color: #fff;
  font-weight: 700;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.mjn-member-auth-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.mjn-member-auth-row button[type="button"] {
  flex: 1;
  border: 1px solid #d6d3d1;
  background: #fff;
  border-radius: 0.9rem;
  padding: 0.85rem 0.75rem;
  cursor: pointer;
}

.mjn-member-auth-row .mjn-member-auth-primary {
  flex: 1.2;
}

.mjn-member-auth-offer {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.85rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.mjn-member-auth-offer p {
  margin: 0;
  font-size: 0.9rem;
}

/* Desktop: centered card rather than bottom sheet */
@media (min-width: 768px) {
  .mjn-member-auth-overlay {
    align-items: center;
    padding: 2rem;
  }

  .mjn-member-auth-sheet {
    border-radius: 1.25rem;
    max-height: min(85vh, 36rem);
    padding: 1.25rem 1.35rem;
  }
}

/* IME / visualViewport: keep sheet above keyboard when host sets vv bottom */
html[data-mjn-member-auth-open="1"] .mjn-member-auth-sheet {
  margin-bottom: var(--mjn-vv-bottom, 0px);
}

@media (prefers-reduced-motion: reduce) {
  .mjn-member-auth-overlay,
  .mjn-member-auth-sheet {
    transition: none !important;
  }
}

/* Avoid covering mini assistant CTA area on detail pages when open */
html[data-mjn-member-auth-open="1"] .mjn-detail-character-guide--mini {
  opacity: 0.35;
  pointer-events: none;
}
