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

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

body.mm-public-page .cls-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(--cls-hud-line-dim);
  background: var(--cls-bg-void);
}

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

.mm-public-header__brand .cls-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: 3px;
  font-family: var(--cls-font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cls-text-muted);
  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(--cls-text-primary);
  background: rgba(168, 85, 247, 0.06);
  border-color: var(--cls-hud-line-dim);
}

.mm-public-header__link.is-active {
  color: var(--cls-purple-400);
  border-color: var(--cls-purple-500);
  background: rgba(168, 85, 247, 0.1);
}

.mm-public-header__link:focus-visible {
  outline: 2px solid #c084fc;
  outline-offset: 2px;
}

.mm-public-header__link--discord {
  color: var(--cls-purple-400);
  border-color: rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.08);
}

.mm-public-header__link--discord:hover {
  color: var(--cls-text-inverse);
  background: var(--cls-purple-500);
  border-color: var(--cls-purple-500);
}

.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.cls-app[data-page="purchase"] .mm-public-header {
  position: sticky;
  top: 0;
}

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

body.mm-public-page.cls-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;
  background: var(--cls-hud-panel);
  border: 1px solid var(--cls-hud-line-dim);
  border-radius: 4px;
  box-shadow: none;
  animation: mmAuthIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mm-auth-card {
  position: relative;
  width: min(460px, 100%);
  padding: 0;
  overflow: hidden;
  background: var(--cls-hud-panel);
  border: 1px solid var(--cls-hud-line-dim);
  border-radius: 4px;
  animation: mmAuthIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Signature: violet corner brackets locking onto the sign-in box */
.mm-auth-card::before,
.mm-auth-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  z-index: 4;
  opacity: 0.55;
  pointer-events: none;
}

.mm-auth-card::before {
  top: 0;
  left: 0;
  border-top: 2px solid var(--cls-purple-500);
  border-left: 2px solid var(--cls-purple-500);
}

.mm-auth-card::after {
  bottom: 0;
  right: 0;
  border-bottom: 2px solid var(--cls-purple-500);
  border-right: 2px solid var(--cls-purple-500);
}

@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(--cls-space-8) var(--cls-space-8) var(--cls-space-6);
  border-bottom: 1px solid var(--cls-hud-line-dim);
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.06), transparent 50%);
}

.mm-auth-brand .cls-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(--cls-text-xl);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.25;
  color: var(--cls-text-primary);
}

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

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

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

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

.mm-auth-error {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: var(--cls-space-4);
  padding: 11px 14px;
  border-radius: 3px;
  font-size: var(--cls-text-sm);
  line-height: 1.45;
  background: rgba(248, 131, 131, 0.08);
  border: 1px solid rgba(248, 131, 131, 0.35);
  color: var(--cls-danger);
}

.mm-auth-error i {
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.9;
}

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

.mm-auth-error--warn {
  background: rgba(247, 186, 83, 0.08);
  border-color: rgba(247, 186, 83, 0.4);
  color: var(--cls-warning);
}

.mm-auth-error--danger {
  background: rgba(248, 131, 131, 0.12);
  border-color: rgba(248, 131, 131, 0.5);
  color: var(--cls-danger);
}

.mm-auth-help {
  margin-top: var(--cls-space-6);
  padding: var(--cls-space-5);
  border-radius: 4px;
  border: 1px solid rgba(168, 85, 247, 0.22);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: none;
}

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

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

.mm-auth-help__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 3px;
  font-size: var(--cls-text-sm);
  font-weight: 700;
  text-decoration: none;
  color: var(--cls-text-inverse);
  background: var(--cls-purple-500);
  border: 0;
  box-shadow: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mm-auth-help__btn:hover {
  opacity: 1;
  color: var(--cls-text-inverse);
  background: var(--cls-purple-400);
  transform: none;
  box-shadow: none;
}

.mm-auth-help__btn:focus-visible {
  outline: 2px solid #c084fc;
  outline-offset: 2px;
}

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

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

.cls-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(--cls-text-xl);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.25;
  color: var(--cls-text-primary);
}
