/* Public pages — purchase scrolls the document; login fills viewport minus header */
body.mm-public-page.z5-app {
  display: block;
  min-height: 100dvh;
}

body.mm-public-page.z5-app[data-page="login"] {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.mm-public-page .z5-app-scene {
  position: fixed;
  inset: 0;
}

.mm-public-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--z5-border-subtle);
  background: rgba(12, 18, 32, 0.92);
  backdrop-filter: blur(12px);
}

.mm-public-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--z5-text-primary);
  font-weight: 700;
  font-size: var(--z5-text-base);
}

.mm-public-header__brand .z5-logo {
  width: 32px;
  height: 32px;
}

.mm-public-header__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mm-public-header__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--z5-radius-md);
  font-size: var(--z5-text-sm);
  font-weight: 500;
  color: var(--z5-text-secondary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.mm-public-header__link:hover {
  color: var(--z5-text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.mm-public-header__link.is-active {
  color: var(--z5-text-primary);
  border-color: var(--z5-border-strong);
  background: var(--z5-color-primary-muted);
}

.mm-public-header__link--discord {
  color: #c4caf8;
  border-color: rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.1);
}

.mm-public-header__link--discord:hover {
  color: #fff;
  background: rgba(88, 101, 242, 0.2);
}

.mm-public-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  overflow-x: hidden;
}

body.mm-public-page.z5-app[data-page="purchase"] .mm-public-header {
  position: sticky;
  top: 0;
}

body.mm-public-page.z5-app[data-page="login"] .mm-public-header {
  flex-shrink: 0;
}

body.mm-public-page.z5-app[data-page="login"] .mm-public-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Sign-in card */
.w3-mm .card.mm-auth-card {
  width: min(460px, 100%);
  margin: 0 auto;
  box-shadow: var(--z5-shadow-lg), 0 0 48px rgba(55, 211, 154, 0.12);
  animation: mmAuthIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mm-auth-card {
  width: min(460px, 100%);
  padding: 0;
  overflow: hidden;
  animation: mmAuthIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes mmAuthIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.mm-auth-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: var(--z5-space-8) var(--z5-space-8) var(--z5-space-6);
  border-bottom: 1px solid var(--z5-border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.mm-auth-brand .z5-logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.mm-auth-brand__text {
  flex: 1;
  min-width: 0;
}

.mm-auth-brand h1 {
  margin: 0;
  font-size: var(--z5-text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.mm-auth-brand p {
  margin: 8px 0 0;
  font-size: var(--z5-text-sm);
  color: var(--z5-text-secondary);
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.mm-auth-body {
  padding: var(--z5-space-6) var(--z5-space-8) var(--z5-space-8);
}

.mm-auth-form .z5-field {
  margin-bottom: var(--z5-space-5);
}

.mm-auth-form .z5-field__label {
  display: block;
  margin-bottom: var(--z5-space-2);
}

.mm-auth-error i {
  margin-right: 6px;
}

.mm-auth-error {
  display: block;
  margin-bottom: var(--z5-space-4);
  padding: 11px 14px;
  border-radius: var(--z5-radius-md);
  font-size: var(--z5-text-sm);
  line-height: 1.45;
  background: rgba(255, 77, 103, 0.1);
  border: 1px solid rgba(255, 77, 103, 0.35);
  color: #ff8fa3;
}

.mm-auth-error[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
  border: 0;
}

.mm-auth-help {
  margin-top: var(--z5-space-6);
  padding: var(--z5-space-5);
  border-radius: var(--z5-radius-md);
  border: 1px solid rgba(88, 101, 242, 0.22);
  background: rgba(88, 101, 242, 0.06);
}

.mm-auth-help__title {
  margin: 0 0 6px;
  font-size: var(--z5-text-sm);
  font-weight: 600;
  color: var(--z5-text-primary);
}

.mm-auth-help__text {
  margin: 0 0 var(--z5-space-4);
  font-size: var(--z5-text-sm);
  line-height: 1.55;
  color: var(--z5-text-secondary);
}

.mm-auth-help__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--z5-radius-md);
  font-size: var(--z5-text-sm);
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: #5865f2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.mm-auth-help__btn:hover {
  background: #4752c4;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.35);
}

.mm-auth-help__btn i {
  font-size: 1.15em;
}

/* Inner app shell */
.z5-app-content .mm-auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(560px, calc(100dvh - 200px));
  padding: 8px 0 24px;
}

.z5-app-content .mm-auth-wrap.w3-mm {
  max-width: none;
}

.w3-mm__page:has(.mm-auth-card) {
  display: flex;
  justify-content: center;
  width: 100%;
}

.mm-auth-brand h2 {
  margin: 0;
  font-size: var(--z5-text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
