:root {
  --mm-page-bg: #0f1720;
  --mm-page-bg-alt: #121b28;
  --mm-text: #f4f7fb;
  --mm-text-muted: #a2b4c7;
  --mm-surface: rgba(255, 255, 255, 0.04);
  --mm-surface-strong: rgba(8, 14, 22, 0.82);
  --mm-border: rgba(255, 255, 255, 0.08);
  --mm-accent: #00c4b4;
  --mm-accent-text: #07262b;
  --mm-danger: #d64545;
  --mm-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] {
  --mm-page-bg: #eef3f8;
  --mm-page-bg-alt: #f7f9fc;
  --mm-text: #0f1720;
  --mm-text-muted: #526273;
  --mm-surface: rgba(255, 255, 255, 0.92);
  --mm-surface-strong: rgba(255, 255, 255, 0.94);
  --mm-border: rgba(15, 23, 32, 0.12);
  --mm-accent: #00b5a7;
  --mm-accent-text: #ffffff;
  --mm-danger: #c93b3b;
  --mm-shadow: 0 14px 36px rgba(14, 29, 45, 0.12);
}

.hidden {
  display: none !important;
}

.mm-gate {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mm-gate-button {
  border: 1px solid var(--mm-border);
  background: var(--mm-surface);
  color: var(--mm-text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  min-width: 48px;
  white-space: nowrap;
}

.mm-gate-button.primary {
  background: var(--mm-accent);
  color: var(--mm-accent-text);
  border-color: transparent;
}

.mm-gate-button:hover,
.mm-gate-menu-item:hover {
  opacity: 0.92;
}

.mm-gate-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--mm-surface-strong);
  border: 1px solid var(--mm-border);
  border-radius: 14px;
  box-shadow: var(--mm-shadow);
  padding: 8px;
  z-index: 60;
}

.mm-gate-menu.hidden {
  display: none;
}

.mm-gate-menu-title {
  padding: 8px 10px 10px;
  color: var(--mm-text-muted);
  font-size: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mm-gate-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--mm-text);
  text-align: left;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mm-gate-menu-item.danger {
  color: #ffb4b4;
}

.mm-gate-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 9, 16, 0.58);
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 28px);
  backdrop-filter: blur(8px);
  z-index: 90;
}

.mm-gate-modal-backdrop.hidden {
  display: none;
}

.mm-gate-modal {
  box-sizing: border-box;
  width: min(calc(100vw - 28px), 440px);
  max-height: min(92svh, 760px);
  overflow-y: auto;
  background: var(--mm-surface-strong);
  border: 1px solid var(--mm-border);
  border-radius: 18px;
  box-shadow: var(--mm-shadow);
  padding: 22px;
  color: var(--mm-text);
  display: grid;
  gap: 16px;
}

.mm-gate-modal-head {
  display: grid;
  gap: 10px;
}

.mm-gate-modal h2 {
  margin: 0;
  font-size: 12px;
}

.mm-gate-modal p {
  margin: 0;
  color: var(--mm-text-muted);
  font-size: 7px;
  line-height: 1.5;
}

.mm-gate-form {
  display: grid;
  gap: 14px;
}

.mm-gate-form-group {
  display: grid;
  gap: 12px;
}

.mm-gate-form-group--double {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mm-gate-form label {
  display: grid;
  gap: 6px;
  font-size: 7px;
  color: var(--mm-text-muted);
}

.mm-gate-field > span {
  color: var(--mm-text);
  font-weight: 700;
}

.mm-gate-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  font-size: 8px;
  border-radius: 12px;
  border: 1px solid var(--mm-border);
  background: var(--mm-surface);
  color: var(--mm-text);
}

.mm-gate-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  font-size: 8px;
  border-radius: 12px;
  border: 1px solid var(--mm-border);
  background: var(--mm-surface);
  color: var(--mm-text);
}

.mm-gate-combo {
  display: flex;
  align-items: stretch;
  min-height: 50px;
  border: 1px solid var(--mm-border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--mm-surface);
}

.mm-gate-combo:focus-within {
  border-color: rgba(0, 196, 180, 0.58);
  box-shadow: 0 0 0 3px rgba(0, 196, 180, 0.14);
}

.mm-gate-combo select,
.mm-gate-combo input,
.mm-gate-combo button {
  border: 0;
  border-radius: 0;
  background: transparent;
  margin: 0;
  box-shadow: none;
}

.mm-gate-combo select:focus,
.mm-gate-combo input:focus,
.mm-gate-combo button:focus {
  outline: none;
}

.mm-gate-combo select {
  width: auto;
  min-width: 112px;
  max-width: 140px;
  border-right: 1px solid var(--mm-border);
}

.mm-gate-combo input {
  flex: 1 1 auto;
}

.mm-gate-phone-row,
.mm-gate-password-row {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.mm-gate-password-toggle {
  width: 52px;
  min-width: 52px;
  border-left: 1px solid var(--mm-border);
  color: var(--mm-text);
  cursor: pointer;
  font-size: 9px;
  display: grid;
  place-items: center;
}

.mm-gate-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  color: var(--mm-text);
  font-size: 7px;
}

.mm-gate-check input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.mm-gate-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.mm-gate-auth-tab {
  border: 1px solid var(--mm-border);
  background: var(--mm-surface);
  color: var(--mm-text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

.mm-gate-auth-tab.active {
  background: var(--mm-accent);
  color: var(--mm-accent-text);
  border-color: transparent;
}

.mm-gate-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.mm-gate-error {
  min-height: 18px;
  color: #ff9d9d;
  font-size: 6.5px;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.mm-gate-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 8px 8px;
  text-align: center;
}

.mm-gate-pending.hidden {
  display: none;
}

.mm-gate-pending-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--mm-accent, #3b82f6);
  color: var(--mm-accent-text, #fff);
  font-size: 26px;
  line-height: 52px;
  text-align: center;
  flex-shrink: 0;
}

.mm-gate-pending-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--mm-text, inherit);
}

.mm-gate-pending-message {
  font-size: 14px;
  line-height: 1.5;
  color: var(--mm-text-muted, inherit);
  margin: 0;
  max-width: 280px;
}

@media (max-width: 520px) {
  .mm-gate-form-group--double {
    grid-template-columns: 1fr;
  }

  .mm-gate-modal-backdrop {
    padding: 14px;
  }

  .mm-gate-modal {
    width: calc(100vw - 28px);
    border-radius: 16px;
    padding: 16px;
  }

  .mm-gate-phone-row {
    min-height: 48px;
  }

  .mm-gate-form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mm-gate-form-actions .mm-gate-button {
    min-height: 48px;
    pointer-events: auto;
  }

  .mm-gate-auth-tabs {
    position: sticky;
    top: 0;
    background: var(--mm-surface-strong);
    z-index: 1;
    padding-bottom: 2px;
  }

  .mm-gate-combo select {
    min-width: 96px;
    max-width: 122px;
  }
}
